Download Google Asynchronous Tracking for X-Cart
Even when I first started using Google Analytics I always preferred to put the tracking code at the top of the page. It just made more sense to me to make sure that I didn’t loose or miss some visitors in the statistics.
I understand why it is normally recommended to add it to the bottom. By putting it at the bottom it allows your entire page to load, and the last thing to load is the Google Analytics so that the visitors can view the page faster.
If you put it at the top then your page will stall until the Analytics code is fully loaded before continuing to load the rest of the page. As we all know visitors are pretty impatient so the faster the page loads the better.
For the most part, I keep my sites pretty slim and trim anyway. And if it loaded last then a visitor could potentially visit a page, and then leave before the tracking loaded, or even click off to another page throwing off your entry page stats as well as bounce rates, number of pages visited, etc, etc.
But here’s where the Asynchronous Tracking can help out. This code is designed to load first in the <head> tags of your page, and it will load at the same time as your page. This prevents any delays, but also ensures you are getting the statistics you really need.
Anyway, on to X-Cart. They’ve been including a little module for some time now that makes it pretty easy to just turn on and have statistics streaming in no time. But it was always at the bottom of the page, last thing to load.
I created a little mod for you guys here that will allow you to use the Google Asynchronous Tracking.
You can’t just swap out the main Google Tracking code for the Asynchronous otherwise the Commerce tracking will stop working. So I’ve fixed both sections and tried to keep it as minimal as possible on edits.
I did however create the mod as a separate mod instead of just modifying the Google Analytics that was there. This benefits you because you can easily switch back and forth if you are not sure of all this mumbo jumbo.
The file is included below for download. Uncompress it. You’ll find a README inside with quick instructions. As well as the only two files that need to be uploaded. I’ve tested it in 4.2.x and 4.3.x there are a few varying instructions so read carefully.
Most importantly, if you find problems or need help do not hesitate to ask. I’ll be glad to help as I need this in tip top shape for my projects anyway.
Download Google Asynchronous Tracking for X-Cart
Related posts:
