Google has been continuously improving Google Analytics, Google Ads, and Search Console. Just as it used data collected from its free services to enhance the 360 product family, it is now also forwarding development notifications gathered from the 360 family to its free access offerings.
The global site tag, which initially started with Google Analytics and Google Ads for user data, activity, and cookie access, serves as an example of this change. Subsequently, the Google Tag Manager, enhanced through these updates to become more efficient, now sits at the core of the process. As a result of the latest update, Google Analytics and Google Ads installations are now being carried out via the global site tag, specifically using gtag.js, through googletagmanager.com. I will provide more detailed information regarding the global site tag in future posts. For now, let’s take a brief look at the global site tag (gtag.js).
As of July 2023, Universal Analytics (UA) is being phased out in favor of Google Analytics 4 (GA4). After this date, UA properties will no longer be able to process new data. They are expected to become inaccessible by the end of the year. For more details on the differences between property types and other operations, please refer to my article titled Universal Analytics (UA) to Google Analytics 4 (GA4). If you have any questions or need technical support, you can request assistance through technical support.
Global Site Tag, GTAG (gtag.js)
As I mentioned, there have been updates to Google services for some time now. The first change involves modifications to the website conversion tracking tag. As a result of long-standing issues and requests for detailed development, a centralized structure using a global site tag has been implemented. Starting October 2017, Ads and Analytics have been able to evaluate each page using a single global tag, enabling consistent tracking and distribution across the site through a global site tag and an activation snippet.1
You may have received a notification titled “Update your website conversion tag” regarding this change. The details of the notification you received are as follows: “The ‘pixel-only’ conversion tag you’re using does not track conversions in some browsers. To ensure your website’s conversions are properly measured, start using the new website conversion tag available in the updated Ads experience.”2 Doesn’t that sound serious? At the very least, there’s no need to panic right now. If you’ve set up your tracking using Google Tag Manager, you likely wouldn’t have received this notification. At this stage, you probably don’t need to make any changes (with one exception: I’ll also mention the GTM Conversion Tracker setup). Fundamentally, this notification could be considered a preparatory step for potential future improvements. My recommendation is to update the ready code, but carry out this update through your setup via Google Tag Manager. This way, you can closely monitor the process and encounter fewer issues. So, how exactly do we implement the global site tag and the campaign snippet that will replace the old conversion tracking tag starting October3?
GTAG (gtag.js) Usage
GTAG consists of a global site tag and an event snippet for tracking your conversions. The event snippet uses gtag('event', '[parameters]') to inform the global site tag about how and when a conversion or event should be tracked.
As we are familiar with the installation of Google Analytics and Google Tag Manager, the global site tag should be implemented to function across all pages4. Google Ads Remarketing code is typically set to run across all pages, while the conversion code is triggered in specific scenarios—such as button clicks, page views, video plays, content sharing, and similar events—using the new structure, where we only need to define the conversion parameter within the event snippet (gtag(‘event’, eventName, eventParameters);). If you’re using Segment, you’ll notice the similarity in usage patterns. Thanks to this common structure implemented on each page, you’ll only need to define the ID through the config parameter in both Analytics and Ads setup.
Ensure that the gtag.js JavaScript file path is included in all operations and on all pages.
<script async src="https://www.googletagmanager.com/gtag/js?id=UA|AW-ID"></script>
gtag('config', 'UA-12345678-9');
gtag('config', 'AW-123456789');
Below are example implementations of the global site tag for Google Ads and Google Analytics.
Global Site Tag: Google Ads
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments)};
gtag('js', new Date());
gtag('config', 'AW-123456789');
Global Site Tag: Google Analytics
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments)};
gtag('js', new Date());
gtag('config', 'UA-12345678-9');
As you can see, the global site tag follows the same structure up to the ID values specified in the config parameter. For shared tag usage, it’s sufficient to define the ID for https://www.googletagmanager.com/gtag/js using the property ID from your Google Analytics account. What’s crucial is that the service definitions must be properly implemented as event snippets.
Event Snippet
The following event snippet should be placed directly on the conversion page and/or the transaction process, associated with Google Ads. This event can be linked to any situation such as a pageview, pageload,, button click, scroll position, and so on. What’s important is that the snippet is placed after the Global Site Tag. Below is an example of an event snippet that would be triggered via a pageview (for example, a thank-you page):
gtag('event', 'conversion', {
'send_to': 'AW-123456789/AbC-D_efG-h12_34-567',
'value': 1.0,
'currency': 'TRY'
});
Let’s now look at two additional examples of events for Google Analytics pageview and video interaction events:
gtag('config', 'UA-12345678-9', {
'page_title': 'homepage',
'page_location': 'https://domain.com/home',
'page_path': '/home'
});
gtag('event', 'video_play', {
'video_title': 'My promotional video',
'duration': '01:32',
'non_interaction': true
});
Sharing an Existing Global Site Tag
Now you can be certain that the Global Site Tag has been added to all pages viewed by users and visitors. Based on our planning for conversion actions, we have defined which conversion actions (such as pageview, button click, etc.) should be accepted. At this stage, instead of reinserting the Global Site Tag, you only need to add your Ads ID value as a config parameter. You can see the additions made in the highlighted line of the example below, corresponding to your Ads account or GA4 property. This way, you can enable multiple Google services to operate together, all benefiting from a single installation and support for the Global Site Tag.
gtag(‘config’, ‘UA-12345678-9’); gtag(‘config’, ‘G-123456789’); gtag(‘config’, ‘AW-123456789’);
In the meantime, you can use the same global snippet for multiple Ads or Google Analytics accounts. For each additional Ads or Google Analytics account you’d like your tag to support, simply add a new “config” command containing the account ID, which will link your tag to the respective account.
Differences Between analytics.js and gtag.js
gtag.js offers a more practical and functional usage structure5. On the other hand, it enables faster data transmission compared to analytics.js operations6. However, the most significant improvement is the ability to easily evaluate data across different services. Although Google Analytics and Google Ads have different conversion definitions, they operate through a common codebase, which helps prevent errors in code-based implementations and enables more accurate conversion tracking. I will provide further details on the activities supported by the Global Site Tag (GTAG) in future posts, including updates related to e-commerce structures7.
*[GTM]: Google Tag Manager
*[GTAG]: Global Site Tag
*[GA4]: Google Analytics 4
Footnotes
- Enrico Pavan. (2017). Global Site Tag: the new Google tracking code. Analytics Boosters ↩
- Set up conversion tracking for your website. Google Ads Help ↩
- Use the Global Site Tag for Google Ads conversion tracking. Google Ads Help ↩
- Add gtag.js to your site. Analytics Help ↩
- Pavan Sharma. (2017). gtag.js Vs analytics.js Analysis in detail. DigitalGenX ↩
- Upgrade analytics.js. Analytics Help ↩
- Ecommerce with gtag.js. Analytics Help ↩