Hi,
I am using new async code of Google Analytics, would it be correct to call GA.js twice in the same page, if not, is there a way to do that ?
My problem is I need to account two PageViews on a booking form using flash, the trouble is that user may not necessarilly get to the second stage but close the window n the first stage.
<!-- Step one, I need to record a pageview -->
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-6173481-3']);
_gaq.push(['_trackPageview', '/Step1']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
<!-- Step two of the process i define a function that will get called by flash and record another pageview-->
function completed (){
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-6173481-3']);
_gaq.push(['_trackPageview', '/Step2']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
}