Set up the Analytics tag

This help center article is part of the App + Web Property Beta.

App + Web properties are not currently supported in the Analytics app.

Set up tagging for a website

When you create a web stream for an App + Web property, Analytics generates a global site tag (gtag.js) with a specific Measurement ID for that stream.

To collect data from your webpages, you need to add the global site tag to your pages or add configuration for your stream’s Measurement ID to an existing on-page tag.

Use an existing on-page tag

Check to see if you have an existing on-page tag

To check for an existing global site tag, view the source code for your relevant web pages and search for "googletagmanager.com".

If there are no search results, you don't have an existing global site tag or Google Tag Manager container implemented on your page. In this case, follow the instructions to add a new page tag.

If you have an older version of the Google Analytics measurement code on your site or you are using a third-party tag-management system, you may not find "googletagmanager.com".

If you see a code reference to “...googletagmanager.com/gtag/js?id=...”, you already have the global site tag (gtag.js) implemented on your page, for example:

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

If you see a code reference to “...googletagmanager.com/gtm.js?id=...”, you already have Google Tag Manager implemented on your page, for example:

 

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXX');</script>
<!-- End Google Tag Manager -->

Determine which product and account controls your on-page tag

If have either a global site tag or have Google Tag Manager implemented on your web pages, you can determine which product and account (or related entity) controls that on-page tag by looking at the URL of the script source.

Global site tag (gtag.js)

When you generate the gtag.js snippet for a product, that snippet includes an ID for that product and the associated account or product-specific entity. This ID appears in two places:

 

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXX-Y"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-XXXXXX-Y');
</script>

 

You may see multiple gtag(‘config’,...) lines for for additional products and accounts, for example:

 

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXX-Y"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-XXXXXX-Y');
  gtag('config', 'UA-YYYYYY-Z');
  gtag('config', 'AW-XXXXXXXXXX');
  gtag('config', 'G-XXXXXXXX');

</script>

 

The product and account whose ID is shown in the script source URL (i.e., the ID at the top of the snippet) is the one that controls the on-page tag.

Product prefixes for global site tags
UA Your global site tag is controlled by Google Analytics. The ID is your Google Analytics Measurement ID. To find the property associated with this ID, use the account search feature in Google Analytics. If the property does not appear, you probably do not have access to it.
G Your global site tag is controlled by a Google Analytics App + Web stream. The ID is your Google Analytics Measurement ID.
AW Your global site tag is controlled by Google Ads. The numeric string following the AW prefix is your Google Ads Conversion ID.
DC Your global site tag is controlled by a Floodlight tag. The numeric string following DC is your Advertiser ID.
other Your global site tag is controlled by a different Google product or may be implemented incorrectly. Use the Tag Assistant extension for Google Chrome to verify.

Google Tag Manager

If you have Google Tag Manager implemented on your page, you will see a Tag Manager container snippet with a container ID, for example:

 

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<:!-- End Google Tag Manager -->

 

To find the Tag Manager container associated with this ID, open the Google Tag Manager accounts screen and search for this ID. If it does not appear, you likely do not have access to the associated container.

Connect your Analytics App + Web tag to an existing on-page tag

If you already have gtag.js for another Google Analytics property or have a Google Tag Manager container implemented on your page, follow the steps in this section to turn on tagging for your web data stream without changing the code on your page.

You will need access to the Google Analytics property or Tag Manager container associated with your on-page tag. If you don’t have the required access, contact an Analytics or Tag Manager administrator in your organization or proceed with the steps to add a new on-page tag.

If your on-page tag is controlled by Google Analytics

  1. Open the Analytics property that controls your on-page tag.
  2. If the ID of your on-page tag uses the format:
    • UA-XXXXX-Y:
      • Go to Admin > Tracking Info > Tracking Code.
      • Click Connected Site Tags under Global Site Tag (gtag.js).
    • G-XXXXXXX
      • Go to Admin > Data Streams > Web.
      • Click Connected Site Tags below Tagging Instructions.
  3. Connect the Measurement ID (e.g., G-XXXXXXXX) of the web stream that you want to turn on tagging for.

    Currently, it’s only possible to connect Google Analytics App + Web Measurement IDs.

Once your site tag is successfully connected, the connected tag will load alongside your on-page tag. For example, if you currently have a Google Analytics tag for a Universal Analytics property implemented on your webpage with a Measurement ID of UA-12345-1, and you connect Measurement ID G-987654321 to that property, data will be sent to both properties when the page loads.

Connected site tags will load only when the tag they're connected to is the one that controls the on-page tag. For example, if you connect Tag A to Tag B, then Tag B must control the on-page tag; if Tag B were connected to Tag C and Tag C controlled the on-page tag, then Tag A would not load.

If your on-page tag is a Google Tag Manager container

  1. Open the Google Tag Manager container that’s implemented on your page.
  2. Click Tags > New.
  3. Click Tag Configuration and select Google Analytics - App + Web Configuration.
  4. Enter the Measurement ID (e.g., G-XXXXXXXX) of the web stream that you want to turn on tagging for.
  5. Select to trigger the tag on All Pages (or on the subset of pages you want to measure).
  6. Save and publish your tag configuration.

If your on-page tag is controlled by another product

Connecting tags for Google Analytics App + Web through existing on-page tags is currently only possible when your on-page global site tag (gtag.js) is controlled by another Google Analytics property or when you use Google Tag Manager.

Add a new on-page tag

If you do not already have the global site tag (gtag.js) or a Google Tag Manager container on your page, you need to add the global site tag (gtag.js) to each page of your site you want to measure.

After you create a new web stream for a Google Analytics App + Web property, Analytics displays a global-site-tag (gtag.js) snippet customized with your stream’s Measurement ID. (If you’ve already left this interface, you can get back to it by navigating to Admin > Data Streams > Web in your App + Web property.) Copy the entire contents of the Global Site Tag code box and paste it immediately after the tag on each page of your site that you want to measure.

Verify data collection

After you've configured your website to collect data, you can use the Real-Time report to verify that your site is actually sending data to Analytics.

Was this helpful?
How can we improve it?