Install the Google tag (gtag.js)

The Google tag (gtag.js) is a single tag you can add to your website to use a variety of Google products and services (e.g., Google Ads, Google Analytics, Campaign Manager, Display & Video 360, Search Ads 360). Instead of managing multiple tags for different Google product accounts, you can use the Google tag across your entire website and connect the tag to multiple destinations.

The Google tag can send data to many Google products

Learn more about the Google tag

Add the Google tag to your website

To start collecting data with the Google tag:

  1. Open a Google product you use and access the Google tag screen. How to find your tag ID in:

  2. Copy your Google tag ID.

  3. Paste your Google tag ID in the code sample below. 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>
    

Verify your tag works

To verify if your tag is sending data:

  1. Open Tag Assistant
    Tag Assistant is a free tool that checks page has been tagged correctly.
  2. Enter the URL of the website you want to verify.
  3. Check if your Google tag ID appears in the header Google tags found. If Tag Assistant doesn't recognize your tag, find debug tips in the Tag Assistant help

Next steps

Now that you've set up your Google tag, configure Google products and send event data.