Page Summary
-
The Google tag is a versatile tag that streamlines the use of various Google products like Google Ads and Analytics, replacing the need for multiple individual tags.
-
Implementing the Google tag offers benefits like future-proof conversion measurement, codeless tag management, easier integration with other Google products, and more accurate conversion tracking.
-
To use the Google tag, copy your tag ID from a Google product (e.g., Google Ads, Analytics), paste it into the provided code snippet, and place the snippet on every page you want to track.
-
Verify your Google tag implementation using Tag Assistant to ensure it's sending data correctly by checking for your tag ID and consulting the Tag Manager help center for troubleshooting.
The Google tag is a single tag you can add to your website to use Google measurement and advertising products like Google Ads, Google Analytics, Campaign Manager, Display & Video 360, and Search Ads 360. Instead of managing multiple tags for different Google products, you can use the Google tag across your entire site and connect the tag to multiple destinations.
Learn more about the Google tag
This page explains how to set up and deploy a Google tag on your site using the gtag.js framework. If you're unfamiliar with javascript, we recommend using Google Tag Manager instead of gtag.js.
Benefits
The best way to measure conversions and optimize the value of your Google marketing investment is to place tags on every page of your site. By implementing the Google tag across your site, you gain access to the following benefits:
- Future-proof conversion measurement. Benefit from the latest features and integrations as they become available so that you are better equipped to continue measuring conversions accurately if changes occur.
- Codeless tag management. Turn on measurement features within Google products without having to manually change the tags on your page.
- Faster and easier integration. Streamlined, simpler implementation and integration with other Google products, such as Analytics and Google Ads.
- More accurate conversion measurement. The Google tag helps you achieve more accurate conversion measurement when cookies are not available and recover conversions not observed today due to industry factors.
Add the Google tag to your website
To collect data with the Google tag:
Open a Google product you use and access the Google tag screen. How to find your tag ID in:
Copy your Google tag ID.
Paste your Google tag ID in the following code sample. Place the Google tag snippet immediately after the opening
<head>HTML tag on every page you want to measure.<!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'TAG_ID'); </script>The
configcommand is needed to send data to Google advertisement products. Many features require theconfigcommand to be set on your website, such as automatically collected events and conversion linking. Learn more about the config command
Verify the Google tag
To verify that your tag is sending data, you can use Tag Assistant or your browser's developer tools.
Verify with Tag Assistant
- Go to tagassistant.google.com/.
- Click Add domain.
- Enter the URL of the website you want to debug, starting with "https://" or "http://".
- Click Connect.
When you connect Tag Assistant to your website, check if your Google tag ID appears in the Google tags found header. A green or blue icon indicates that the tag was found and is working correctly.
If Tag Assistant doesn't recognize your tag, find debug tips in the Tag Manager help center.
You can also access the tag coverage summary for an overview of your site's tagging status.
Verify with browser developer tools
To verify that your tag is sending data using your browser's developer tools:
- Open your website in a new browser tab or window.
- Open your browser's developer tools (usually by right-clicking and selecting
Inspect, or pressing
F12). - Navigate to the Network tab.
- Make sure you can capture all network traffic:
- Check the Preserve log checkbox so requests aren't lost during page reloads or navigation.
- Reload the page if necessary to capture initial requests.
- In the filter box, type
g/collect(the common path for Google Analytics data collection) to narrow down the hits. - Look for requests to
google-analytics.com/g/collect(for Google Analytics) or your server container URL. - Verify that the request was successful:
- Status Code: Look for 204 No Content or 200 OK.
- Payload: Click the request and check the Payload (or Query
String Parameters) tab to make sure the Measurement ID (
tid) and event parameters are being sent.
Next steps
Now that you've set up your Google tag, configure Google products and send event data.