Google Analytics in Header OR Footer

Google Analytics in Header OR Footer


You can skip reading all the below information and just place your tracking code just before the close of your <head> element in your HTML markup. And focus your online marketing efforts towards creating useful content for your website visitors, instead of worrying where you on your website you should place that code. Like this:

Screenshot of Website Source Code

If you want to learn more about why you would actually ask the question as to where you should place the code, perhaps you may have read about Page Load times being important and you have want to load your tracking code after all your webpage elements are loaded, so thus, you can provide a better user experience to your visitor.

If that’s the case, you have to first know this: almost 99% website’s in 2016 internet world do not need to worry about affecting their visitor experience. In fact, unless your target audience is in some country town where the internet signal reception is low, or their internet connection speeds are like “dial up internet connection speed” remember, if your target audience does not fall within the mentioned category, then forget about splitting the Google Analytics code into pieces and place some in the footer and then some in the header element.

You Can if You Want Split the Google Tracking Code in to 2 Parts Like This

Google Analytic Code

Now that you know how to split the tracking code, you should still remember what I shared in the first paragraph and simply place it just before the closing of your head element of your markup. If you are curious about making your web page load faster because Google encourages webmasters (it even is part of Google Analytics reporting) to improve their web page load times, then there are other methods to consider.

HTML5 offers new features for transmissions for scripts (just insert <script async for your scripts) Note: Google analytics already loads asynchronous so you don’t need to insert that code for analytics.js.

You can optimize your image files for web viewing, or even serve different image files for mobile devices. You can accomplish that through media queries (perhaps CSS switch class elements or id elements.)

So basically forget about splitting the Google Analytic tracking code, and instead continue creating useful content for your website visitors.

At times, some search engine optimization circles claim that Google strongly considers page load times for ranking your keywords. Yet, your focus should be focused usability for increased visit durations and reduce  as that will serve well in the long run.

Recent Posts

Leave a Comment


Start typing and press Enter to search

Advanced Search OperatorsKeyword Research