Tag: Google Analytics

Where is YOUR Google Analytics Tracking Code?

The Google Analytics Asynchronous Tracking Code, where should you put it on your site?  Well, for starters lets have a look by checking out Google’s official recommendation for web developers…

The Analytics snippet is a small piece of JavaScript code that you paste into your pages.  It activates Google Analytics tracking by inserting ga.js into the page.  To use this on your pages, copy the code snipped below, replacing UA-XXXXX-X with your web property ID.  Paste this snippet into your website template page so that it appears before the closing tag.

Google Analytics Tracking Code

Right… so regardless of what Google’s official recommendation is – huge websites for really large companies seem to still have  (inserting a tracking code at the bottom of a page was once Google’s recommendation a long time ago) their tracking code at the bottom of the page.

Take Allure as an example.  (Open up Google Browser, At the top of the page click on the tool icon, highlight tools, click on view source, and then ctrl +f and search for Google).  Their tracking code is at the bottom of the page!

You see it?  Ok, let’s hope you do.

Anyways, what I find pretty surprising is how a large, high powered company (and there are many) such as Allure wouldn’t currently be using Google’s best practices.  Especially, when proper placement tracking code would be in their best interest.

Let’s take or Allure again for example.  When you visit the site, one can see that Allure.com features advertisements.  Some of these are from  DoubleClick (a subsidiary of Google which develops and provides Internet ad serving agencies).

So here we go… I think I’m ready to explain this…

So, say Allure.com runs a banner ad at the very top of their website.  And say, Allure has content on their site below the banner ad (such as a rich media file) that takes a long time to load (say 10 seconds or so) and the visitor to the site gets impatient and exits the site.  At this point in time, it is possible that because the tracking code was placed at the BOTTOM of the page, the tracking code did not load and thus, it was not able to count the visit.  However, while Allure.com was not aware that there was even a visitor on the page – the ad from DoubleClick was still served and received an impression.  This information would be valuable to a publisher.  Especially when they are getting paid for these Ad’s to be displayed.  Right?  Profit is in the numbers and it doesn’t hurt to make them as accurate as possible.

So, that’s my point on why it’s important.  Here’s a bit of a brief history on the new vs old code:

Google once had a non-Asyhchronous (aka: traditional) tracking code (prior to the 1st of December 2009), which was to be placed at the bottom of the page.  (As I mentioned above, they’re now recommending users to put the code into the portion of the code (the top of the page).   The non-Asyhchronous code essentially operated as any basic JavaScript code (think line by line).  So, with this – if Google code was placed at the top of a page and Google took 8 seconds to send that tracking code out it would take your site already +8 seconds before the actual website content could load for the viewer.  However, with the new Asychronous tracking code it no longer has to complete line one before taking on line two.  With the Asychronous code, multiple lines can be read at the same time.  (Keeping in mind cases like the Allure/DoubleClick example can sometimes occur).  Another perk of the new code is that it is served from your Cache (so it’s downloaded only once from Google and saved on your computer) – this also helps the code load much faster.

So, even if you are not using Ad serving agencies; from an SEO perspective, with Google organic search now penalizing websites with a slower load time, it’s important to keep your site running up to speed (if you want to remain at the top of that SERP).  Additionally, for those of you using Adwords the new code is also said to lead to a 100% accuracy in tracking data.

So, for those using the traditional code, I suggest jumping on board with the new.  (Though funny enough, spy on my source code, and you’ll see I’m missing Google Analytics entirely) I probably need to get on that in 13′.

Advertisements