ProStores Google Analytics Ansynchronous Tracking Plug-in – FREE
I am happy to offer our new ProStores Google Analytics Ansynchronous Tracking Plug-in for free here on our blog.
From Google, “asynchronous tracking optimizes how browsers load ga.js so its impact on user experience is minimized. It also allows you to put your Analytics snippet higher in the page without delaying subsequent content from rendering.”
Its also much more flexible and advanced, as well as more accurate, you can push multiple commands at once and you can even split the snippet up depending on your configuration.
1. Remove your old Google Analytics code from the footer if you have it. If you have Google E-commerce tracking in your Order Confirm page leave it, neither code will bother the other one.
2. Open your Header Template, saving a baseline as always, and paste in the code below just after the <body> tag.
3. Make sure you replace UA-xxxxxxx-x with your Google Analytics account number.
<!-- Begin Google CODE -->
<ss:if test="$page.bodytemplate.name = 'orderconfirm'">
<ss:comment>do nothing</ss:comment>
<ss:else/>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxx-x']);
_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';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
</script>
</ss:if>
<!-- End Google CODE -->Visit tracking only, doesn’t track e-commerce purchases or purchase information. See my GA – E-Commerce Plug-in to track purchases in your ProStores store.
If you still need assistance Professional install service is available, if you follow me on twitter you can get a discount.
9 Comments to “ProStores Google Analytics Ansynchronous Tracking Plug-in – FREE”
Leave a Reply

Google advises putting the async snippet in the section, not the head:
http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html#Installation
According to the page you linked it says that the best place to put the snippet it at the top of the
<body>tag section, in a ProStores based site that is in whats known as the Header Template. I tweaked a couple things in the post to make what I was saying more clear. thanks for the note!Also if you want to post a html tag in the comments you need to wrap it in < code >
tags. That way it will show up and not be removed.Can this be used in conjunction with the order confirmation template javacsript you posted in your tutorials, such as:
Can this be used in conjunction with the order confirmation template javacsript you posted in your tutorials, such as:
Feel free to delete my other comments, but I did some researching it looks like this should be the proper formating with the gaq_ , you don’t need to publish this comment either but if you could please contact me if I am doing something obviously wrong.
Or just approve them all and don’t delete them. ;D
Lol, well actually your posts get auto approved.
The Async visit tracking code I listed here does in fact work with the previous e-commerce tracking code from here: http://www.onetakemedia.net/prostoresplugins.html#GA
I’ve got it live on several sites and its been working since I posted this.
I haven’t reworked the E-commerce version of plug-in because it works just fine and the Order Confirm page doesn’t really need the speed boost since that page is disallowed in robots.txt by association. Thusly I have not spent the time to re-code it.
Just by glancing at it your code does seem to be laid out correctly. You can always give it a whirl for a couple purchases and then put the old code back up and check the next day to see if those purchases work.
Thanks Matt, it seems like I am still getting very inconsistent results with the ecommerce tracking. For instance my most popular product doesn’t even come up in my analytics tracking.