If your Universal Analytics property uses gtag.js or analytics.js (including if analytics.js was deployed through a tag management system like Google Tag Manager), the GA4 Setup Assistant wizard can reuse your existing tagging (i.e., the tag being used by your Universal Analytics property). This tag reuse saves you from having to add the tag manually to your web pages and is made possible via a feature called connected site tags.
For website data to continue to flow to your GA4 property, you must keep your Universal Analytics property and connected site tag configuration.
How it works
Here are a few points about how connected site tags work.
- An additional
gtag(‘config’, ‘G-XXXXXXXXXX’)
call is made (without any parameters), which downloads a Google Analytics 4 tag container and sends an automatic page_view event to the Google Analytics 4 property. - Enhanced measurement events (when enabled) are automatically collected in the Google Analytics 4 property, but are not collected in the Universal Analytics property.
Note: If you use analytics.js to load your connected site tag, enhanced measurement events will be disabled in Google Analytics 4. You should consider replacing your analytics.js tag with gtag.js (the Google Tag).
- Any events sent via
gtag(‘event’)
to the Universal Analytics property are also sent to the Google Analytics 4 property. - Connected site tags require the full site to be consistently tagged using a gtag.js or analytics.js snippet (or deployed through a tag management system like Google Tag Manager) that is controlled by a single Universal Analytics property. If your Universal Analytics property receives data from mixed implementations (e.g., some pages are tagged with analytics.js or Google Tag Manager, while others with gtag.js), we recommend that you first retag your site with only gtag.js (the Google tag) or deploy a GA4 tag if using Google Tag Manager.
Considerations
The connected Google Analytics 4 tag is a way to send data to a Google Analytics 4 property without changing your deployed tags. For the best results, make sure that your site consistently tagged using a gtag.js or analytics.js snippet (or deployed through a tag management system like Google Tag Manager). Using different types of Google Analytics tags might lead to inconsistent data reports.
If you use analytics.js on your page, you won’t be able to take advantage of all the features in Google Analytics 4. Here are a few examples of how using analytics.js can impact specific tagging controls for Google Analytics 4:
- Enhanced measurement events won’t work
- Additional configuration of the Google Analytics 4 tag using the gtag.js API will be very limited, and you won’t be able to add additional commands using the API
We encourage you to leverage the full set of Google Analytics 4 and deploy the Google tag on your page for the best Analytics experience.
Add / remove a connected site tag
If you configured a web site tag to send data to a Universal Analytics property, you can reuse this tag to send data to additional destinations like a GA4 property. You can do this in your Universal Analytics property:
Add a connected site tag
- Sign in to your Google Analytics account, and make sure you're in your Universal Analytics property.
- Click Admin.
- In the Property column, click Tracking Info, then Tracking Code.
- Click Connected Site Tags. (You might need to scroll down.)
- On the Connected Tags page, enter the ID for the tag you want to add, then enter a name for the tag if you like.
- Click Connect.
Enable a connected site tag through analytics.js
Navigate to the Connected Tags page following the instructions above, and add the Google tag ID. Check the box Enable Connected tags through analytics.js to reuse the analytics.js tag to send data to Google Analytics 4.
Remove a connected site tag
- Sign in to your Google Analytics account, and make sure you're in your Universal Analytics property.
- Click Admin.
- In the Property column, click Tracking Info, then Tracking Code.
- Click Connected Site Tags. (You might need to scroll down.)
- On the Connected Tags page, go to the row for the tag you want to remove, and click > Remove tag.
Add a GA4 tag to a page with connected site tags
If you’re adding a GA4 tag and would still like to keep the existing connected site tags on your page, follow these rules to make sure events are sent correctly to GA4:
- If you’re using analytics.js on the page, add the Google tag at the top of the page, to appear before the analytics.js tag.
It’s recommended that you have only one Google tag instance on your page at all times, with proper configuration
- If you’re deploying your Universal Analytics tag using Google Tag Manager, you can add your GA4 tags by following these steps.
Make sure to enable the "Ignore duplicate instances of on-page configuration" option as described below.
Ignore duplicate instances of on-page configuration
If the same tag is configured two or more times on the same page, it may result in duplicate data or mixed settings. Enable this option in your Google Analytics 4 property to ignore duplicate instances of on-page config commands.
- In Admin, under Data collection and modification, click Data streams.
Note: The previous link opens to the last Analytics property you accessed. You can change the property using the property selector. You must be an Editor or above at the property level to ignore duplicate instances of on-page configuration.
- Click the specific data stream you'd like to configure.
- In the Google tag section (at the bottom), click Configure tag settings.
- In the Google tag screen, go to the Admin tab, and select Manage Google tag.
- Enable Ignore duplicate instances of on-page configuration.
- Click Save.