Created
November 15, 2011 18:51
-
-
Save rauluranga/1367950 to your computer and use it in GitHub Desktop.
GA Asynchronous Migration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | |
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | |
</script> | |
<script type="text/javascript"> | |
try { | |
var pageTracker = _gat._getTracker("XX-XXXXXXXX-X"); | |
pageTracker._trackPageview(); | |
} catch(err) {} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function track(... rest):void | |
{ | |
if (ExternalInterface.available) { | |
//Old Google Analytics Code | |
ExternalInterface.call("pageTracker._trackPageview",rest[0]); | |
trace("Google Analytics Tracking: " + rest[0]); | |
}else { | |
trace("External interface is not available for this container."); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'XX-XXXXXXXX-X']); | |
_gaq.push(['_setDomainName', '.sample.com']); | |
_gaq.push(['_trackPageview']); | |
(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); | |
})(); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function track(... rest):void | |
{ | |
if (ExternalInterface.available) { | |
//New Google Analytics Code | |
ExternalInterface.call("_gaq.push",['_trackPageview', rest[0]]); | |
trace("Google Analytics Tracking: " + rest[0]); | |
}else { | |
trace("External interface is not available for this container."); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AS3] | |
ExternalInterface.call("_gaq.push(['_trackPageview', 'action'])"); | |
ExternalInterface.call("_gaq.push",['_trackPageview', 'action']); | |
ExternalInterface.call("_gaq.push", ['_trackEvent', 'Categorie', 'Action', 'Label']); | |
[HTML] | |
<a onclick="_gaq.push(['_trackPageview', 'action']); | |
more info at: | |
http://www.google.as/support/forum/p/Google+Analytics/thread?tid=47183d0c1466e278&hl=en | |
http://painteddigital.com/2010/keepin-up-with-google-asynchronous-analytics/ | |
http://code.google.com/apis/analytics/docs/tracking/asyncUsageGuide.html | |
http://code.google.com/apis/analytics/docs/tracking/asyncMigrationExamples.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment