Categories: SEO Tutorials

Place Google Analytics Code

Google Analytics is one of the most accurate website analyzer of the website. It is offered by Google for free with unlimited features to track your website traffic. It is done through Google Analytics Tracking Code which is placed inside every page of the website. As users come on this page the analytic script checks the user behavior. Now there are custom dashboards with multiple website listings that can be managed easily with many google analytics features that are offered free of cost. One of the main questions that comes is where to place Google Analytics code? Should Google Analytics be in the header or footer or body?


In this post we are going to study all the required information that will help you guide understand about placing Google Analytics Code in a more systematic way.


Where to put Google Analytics Code?

Google official recommendation clearly says for efficient results in number of page views the best place to put google analytic code is before the <head> tag. Whether you have static or dynamic header is the most suggested way for proficient results. For static websites the simple code is to be put on every page whereas if you have dynamic site one code can be placed in dynamic header file from which all the analytics is fetched accordingly.


New Google Asynchronous has been proven to get more accurate results regarding page events by margin of 10-20% while with adwords it is 100% accurate for achieving higher performance.

Understanding Google Analytics Tracking Code

Google Analytics Tracking Code is a small JavaScript Code that is added to the website pages to track the visitor presence. This new JavaScript Asynchronous code is quite better than the old ones, loads instantly without any delays as well as once downloaded it can be used again and again by Google from cache only so further not affecting page load performance.

Old Google Analytics JS code used to load line by line affecting page load and performance so it wall recommended to be place at the end of the body tag or in the footer but new Analytics Asynchronous code is better in all prospects for higher performance.

Now Google Analytics is more powerful than ever with their connectivity with Search Console (Webmaster). With this functionality the whole search pattern can be accessed. Every URL, keywords with their impressions are noted which is quite a lot helpful for enhancing SEO performance accordingly.


Although there are few exceptions but it has been proven that header is the best place for analytics. The old version of the Google analytics code was proposed to be placed before </body> tag which has some issues related to page load performance but new asynchronous tracking code is more sensitive and correct with placement in <header> tag, once it starts the code runs parallel with page performance.


There are two ways of using Google Analytics Code
  • Standard Setup : Placing default code in Header is recommended
  • Custom Tracking Code Script : Just before the closing </body> tag for executing it as last element of DOM used for advanced purpose i.e. E-Commerce, Multiple domains, 3rd Party Shopping carts and custom variables



Google Analytics Tracking Code for Website

For HTML/Static websites
If your website is build using HTML only than place your Google analytics before <head> tag ends.

All the HTML pages must have this important analytics code so that every page can be tracked via Analytics data carefully.


For Dynamic Websites
When websites are built dynamically header file is chosen as the best practice, where you can easily put the Google analytics Tracking code. CMS also have the same patterns where one header is dynamically being called on all pages, so putting the code in the header.php does the trick like in WordPress. Although there are lot of plugins that can be configured for Google Analytics as well. Here we are going to know on adding this code directly in the Theme files.


Google analytics tracking code WordPress without plugin

For WordPress go to your dashboard/admin than from Appearance choose ‘Editor’ where you can access all the PHP files directly & choose the header.php and simply place the Analytics code there so every activity is carefully tracked via Google Analytics.


Adding Google Analytics Code in Magento

Whereas in Magento there are default configuration settings and Google API allow easy management for placing Google Analytics code in Magento.


Magento supports both pageviews and E-Commerce tracking a advance version of performance tracking from Google.

Enjoy more Interview and Questions for getting regular information now!


admin

Recent Posts

Modern Toys, Magical Moments: Why the Best Toy Shop in Noida Is More Than Just a Store

When it comes to children, there’s one universal truth: the right toy can spark imagination, build skills, and make memories…

6 months ago

Rediscovering Joy: A New Era of Creativity & Comfort in Toy Stores

In today’s digital age, where screens and gadgets dominate our children’s lives, there’s something heartwarming about a well-loved plush toy…

6 months ago

Unboxing Imagination: Discovering the Joy of Play at a Toy Store in Noida

In a world dominated by screens and fast-paced routines, it’s easy to forget the simple magic of a toy in…

6 months ago

Imagination Unboxed: Discover Joy at the Toy Shop in Delhi

In the heart of Delhi’s vibrant streets lies a world where imagination meets innovation — the magical universe of toys.…

6 months ago

Play with Purpose: Discovering the Ultimate Toy Store in Noida

When was the last time a toy truly amazed you—not just as a product, but as a thoughtful tool for…

6 months ago

From Tears to Toys: Exploring Modern Childhood through Delhi’s Favorite Toy Shop

In the digital age, the way we experience childhood has changed, but the essence remains the same—imagination, exploration, and joy.…

6 months ago