open

A Complete Guide about the Global Site Tag to Install Google Analytics

Apr, 15 2019
|
Share: -

Google Analytics is so designed by Google to help you analyze your website traffic. Although “web analytics” sounds like a very small area of your digital presence but the implications of Google Analytics are huge. As we know your website is the central hub of your digital presence and your website is the best way to give you an overall view of the effectiveness of all the campaigns you are running in order to promote your product/services online. And Google Analytics is a free tool that can help you out to track your digital marketing effectiveness.

It gives you a deeper understanding of the behavior of the visitors visiting your website. You will be going to get insights on how the users are getting engaged with your content. Moreover, you will get to know where they are located, what language they speak and most importantly how they got to your website. In addition you can see if visitors are using a mobile device or desktop, the time spent on a web page and the time when they leave. And you know what this information is fairly enough to help you improve your Digital Marketing strategy and website.

An Introduction to Global Site tag:

For all the new Google Analytics accounts the Global Site Tags are the recommended tracking method now. You only need a single Global Site Tag or Global Snippet per web page. It is mentioned by Google many times that by using gtag.js you will be able to get benefitted by the latest dynamic features and integrations as they will become available. So it means that very soon Google is going to introduce the new features that will be only accessible by using gtag.js and not necessarily in anaylytics.js.

So, basically Global Site tags are the new JavaScript library from Google. But it is not restricted analytics library only like analytics.js, but it also supports the Google Adwords Conversion tracking and in near future it will support tracking for many other Google products. It would not be correct to call gtag.js the next version of Analytics.js but what Google is trying to do, is to use just one JavaScript library to track all of its products.

It is advisable to use the gtag.js code but it doesn’t mean that if you have the previous conversion tracking tag installed on your website then it will not work. It will still work but the recommendation of using the new conversion tracking tag is just for more accurate conversion measurement.  The gtag.js tag should be installed on every page of your website. You will also have to add another piece of code i.e. an event snippet or a phone snippet that is based on the type of conversion you’d like to track, to certain pages on your site. These snippets work simultaneously with the global site tag to track conversions. 

What are the Advantages of implementing gtag.js:

  • It has a complete conversion of all the conversions in comparison of the previous tags which were not able to track all the conversions. But your Google site tag ensures that all your conversions are taken into account.
  • It gives you a more accurate conversion tracking. If you use the global site tag then it sets new cookies on your domain that will store information about the ad click that has brought a user to your site. Which indicates that Google Ads can measure conversions more accurately, The global site tag also let you specify that which interactions with your website should be counted as conversions.
  • It provides an easier integration with other Google products. As we earlier discussed gtag.js not only used by Google Ads, but it is used by other Google products such as Google Analytics also. If you use these other Google products then the global site tag makes the website implementation easier by providing a combined tagging experience.

The Global Site tag Works in the following manner:

The global site tag works simultaneously with another piece of code i.e. with an event snippet or a phone snippet in order to track your conversions. If you want to track website conversions the event snippet tells the gtag.js tag, when to track a conversion. In case you are tracking calls to your website then the phone snippet will replace your business phone number with a forwarding number of Google. At the moment you set up conversion tracking for your website, you can view and copy the global site tag for your account and any snippets that you should use with the tag. Please see the below code snippet examples.

Global Site tag

You need to place the global site tag snippet on all pages of your website and that is in the < head > section of your HTML pages. In case you have previously installed a global site tag at the time of creating another conversion action from the same Google Ads account then you shouldn’t add the global snippet again. If you have installed a global site tag on your website from a different Google product for example Google Analytics or from another Google Ads account you need to follow the instructions to adapt the tag so that it can work for your Google Ads account.

Please look at an example of the global site tag:

 

<!-- Global site tag (gtag.js) - Google Ads: CONVERSION_ID -->

 <script async src="https://www.googletagmanager.com/gtag/js?id=AW-CONVERSION_ID"></script>

 <script>

   window.dataLayer = window.dataLayer || [];

   function gtag(){dataLayer.push(arguments);}

   gtag('js', new Date());

   gtag('config',AW-CONVERSION_ID');

 </script>

 

Event snippet

If you want your website conversion tracking to work properly then you should install the event snippet on the conversion page itself. You can place it anywhere in the code, after the global tag snippet. Our recommendation will be to place it within the

section for the best tracking accuracy.

Please look at an example of event snippet:

 

 <!-- Event snippet for Example conversion page -->

   <script>

     gtag('event', 'conversion', {'send_to': 'AW-CONVERSION_ID/CONVERSION_LABEL',

       'value': 1.0,

       'currency': 'USD'

     });

   </script>

 

Phone snippet

You need to add a phone snippet to the pages on your website where the phone number you would like to track appears. You should place phone snippet right after the global site tag.

Please have a look on the example of a phone snippet:

 

<script>

 gtag('config', 'AW-CONVERSION_ID/CONVERSION_LABEL', {

   'phone_conversion_number': '1-650-555-5555'

 });

</script>

 

How to install the code snippet on your website?

The setup will sound a bit technical to you, but don’t worry we will guide you through every step of the process. You can install Google Analytics by directly copy and pasting the code snippet after the opening head HTML tag of all your web page.

The following code snippet is an example of the Global Site Tag. What you will need to do is to replace with the Tracking ID of your Google Analytics property where you want to store the tracking data.

 

<!-- Global site tag (gtag.js) - Google Analytics -->

<script async src="https://www.googletagmanager.com/gtag/js?id=<GA_TRACKING_ID>"></script>

<script>

  window.dataLayer = window.dataLayer || [];

  function gtag(){dataLayer.push(arguments);}

  gtag('js', new Date());

  gtag('config', '<GA_TRACKING_ID>');

</script>

 

When you add the Global Site Tag on each page of your website then the page views are automatically captured by default. And It is the desired behavior in most of the cases.

But to initiate the function gtag() correctly it’s essential to place the Google Analytics Tracking Code at the top of every page. You can use the commands gtag() at whatever position of your web page code but the thing to keep in mind is that your commands appear below the Tracking Code. Let us make the position clear with a good example of the HTML code.

<!DOCTYPE html>

<html>

<head>

    <!-- Global site tag (gtag.js) - Google Analytics -->

    <script async src="https://www.googletagmanager.com/gtag/js?id=<GA_TRACKING_ID>"></script>

    <script>

        window.dataLayer = window.dataLayer || [];

        function gtag(){dataLayer.push(arguments);}

        gtag('js', new Date());

        gtag('config', '<GA_TRACKING_ID>');

    </script>

    <!-- ALL OTHER STUFF GO BELOW THIS LINE -->

    <title>Page Title</title>

     

</head>

<body>

    <p>

    Hello world!</br>

    Let's get Digital...</br>

    Oke bye!

    </p>

</body>

</html>

 

Author Bio

The author is SEO Expert, working with Best SEO Company in Delhi. He helps in building value-conscious traffic on several businesses sites. In his articles, he has given tremendous ideas related to SEO and how to increase the user base, and boost web sales and customer satisfaction. There are thousands of tricks and techniques he follows. Get in touch with him @ info@jeewangarg.com

The scope of Digital Marketing in India

Feb, 05 2018
The scope of Digital Marketing in India

21st century, an era of technology where innovations, ideas, intelligence, knowledge and creativity speaks. In this era Digitalization is on the hi...

Read More

Thinking of Hiring Digital Marketing Agency? Consider These Tips

Feb, 15 2018
Thinking of Hiring Digital Marketing Agency? Consider These Tips

Do you think that stereotype advertisements are still the best choice to solicit greater demand for your products? Think again! In the present worl...

Read More

Contact Us Drop Us a Message

Office Address

#987, Sector- 37
Near Mathura Road, Faridabad
Haryana 121003 (INDIA)

Phone

0129-4005987

+91-9350809090
+91-9250809090

Email

info@jeewangarg.com

upsjeewan@gmail.com