What is the Global Site Tag (gtag)? (How to Install & More)

With the introduction of GA4 there’s been a lot of confusion surrounding Google’s free analytics product. Some tools have been depreciated, and there are even signs that usage may be waning with the specter of Universal Analytics depreciation looming:

Google analytics usage since 2000 according to Builtwith
Chart via Builtwith

One confusing element for many Google Analytics users is around setup and tagging. Once you add Google Tag Manager to your site, is Google Analytics set up? If Google Analytics is working now, do you need a new tag for GA4? What is this gtag?

For a lot of Google Analytics users, it feels like you need an advanced Google Analytics certification just to figure out how to set up your account.

In this post, we’ll answer these questions and walk you through what gtag is, when you need to use it, some common mistakes and misconceptions associated with it, and how to make sure you’re getting the most out of your tag set up.

What is Gtag?

Gtag (gtag.js) is the abbreviation for The Google Tag, a JavaScript-based tag you can add to your website to use multiple Google products, including Google Analytics.

Gtag was formerly referred to as The Global Site Tag. 

According to Google:

“If you set up Analytics on your site after August 2017, your site is probably tagged with gtag.js. If you set up Analytics on your site before August 2017, your site is probably tagged with analytics.js.”

How to Install Gtag?

A screenshot of Google's instructions on how to manually install Gtag, which is one option for getting Google Tag onto your site.

Installing Gtag is essentially the same process as installing most java-script based products:

  1. You get the code from your personal account
  2. Install that code on the web pages that the product needs to interact with (in the case of Google Analytics, this will be any pages you want to track with GA)
  3. Ensure within the tool you’re using that the tag is firing properly and tracking everything you want to.

Google’s help documentation has a thorough walkthrough process for setting up GA4 if you don’t have an account, as well as a video walkthrough:

Common Gtag Installation Issues & Errors

A screenshot of Google's legacy Google Tag Assistant Chrome plugin identifying issues with Gtag installation.

As you’re adding Gtag to your site, there are a few key factors to keep in mind (or, if you’re not currently getting the data you want out of your analytics or are concerned about data quality, here are some items to check):

  • Tag Placement – You want to have the tag placed just after the opening <head> tag. Having the tag load after other elements or using “non-standard implementation” can result in the tag not firing properly / consistently. 
  • Multiple Installations of GTAG – Having the code loaded multiple time on a template, site-wide, or on a single page can obviously lead to data issue as well.
  • Missing or Invalid Account ID – If you grabbed sample code or code from a previous installation of gtag make sure you updated or added the account ID to the proper associated account.

Google’s Tag Assistant, debugging view in analytics, and lists of common errors can be helpful in troubleshooting specific issues. If you’re quickly trying to diagnose an issue with an account you don’t have access to, Google’s legacy tag assistant Chrome plugin can also be helpful.

GTAG FAQs

While what GTAG is is fairly straightforward, there are a number of common questions people ask in regards to GTAG. We’ll walk through a number of those here.

What is GTAG (the Google Tag) vs GTM (Google Tag Manager)?

GTAG is the tag that you add to your site to send data to a number of Google products, including Google Analytics. 

GTM is a Google product that allows you to manage tracking code (like GTAG) and to create triggers to send specific data to Google Analytics.

GTAG can be added to your site manually, or via GTM. 

Where should I put GTAG?

It’s recommended GTAG be included just after the opening <head> tag

Can you use GA and GTAG?

Yes, GTAG is the tag or code snippet that allows you to pass information to multiple Google products, including Google Analytics.

How do I find my GTAG in Google Analytics?

This depends on the version of Google Analytics you’re using and whether you’re setting up your account or it’s already live. Google’s support documentation offers a look at how to find your account number or Google Tag:

To find your Google tag, do the following:

  1. Sign in to your Google Analytics account.
  2. Click Admin.
  3. At the top of the Property column, select your property.
  4. In the Property column, click Data streams > Web.
  5. Click the data stream for your website.
  6. Under Google tag, click View tag instructions.
  7. On the Installation instructions page, select Install manually:
    • On the screen, you’ll see the JavaScript snippet for your account’s Google tag. Your Google tag is the entire section of code that appears, beginning with:

      <!– Google tag (gtag.js) –>

      and ending with

      </script>

Can I use both GTAG and GTM?

It’s recommended that you either configure the GTAG manually or set it up in GTM, but the two are certainly compatible in the sense that you can set up tracking in GTM.

Is GTAG needed?

Google is sunsetting Universal Analytics and GTAG is the Google Tag for GA4, so you will need to have GTAG implemented on websites moving forward. Again though GTAG can be integrated via GTM rather than manually, so manually installing gtag.js on a site isn’t necessary if you have it installed via GTM.

Of course if you’re not using GTAG to enable data transfer to Google Analytics or another Google product, you don’t need GTAG at all.

What is GTAG config?

The gtag config command makes basic measurement like the automatic collection of page views possible.

What is GTAG dataLayer?

Google (via either GTAG or GTM) uses the “dataLayer” to pass specific information to various Google products. The dataLayer is an object (structured as JSON) that can pass specific information like the value of a purchase, a specific action, the depth a user scrolls, etc. to platforms like Google Analytics or Google AdWords.

Create Your Own Google Analytics Dashboards

Once you have GTAG installed, you’ll likely want to move to getting actionable insights from your analytics account. 

If you’re using WordPress, the ShareThis Google Analytics Dashboard for WordPress can help you monitor your traffic and engagement for free with just a few clicks.

About ShareThis

ShareThis has unlocked the power of global digital behavior by synthesizing social share, interest, and intent data since 2007. Powered by consumer behavior on over three million global domains, ShareThis observes real-time actions from real people on real digital destinations.

Subscribe to our Newsletter

Get the latest news, tips, and updates

Subscribe

Related Content