[UA→GA4] Tips for implementing GA4 with Google Tag Manager [Legacy]

You are viewing a legacy article about Universal Analytics. Learn more about Google Analytics 4 replacing Universal Analytics.
This article is for website owners who have been using Universal Analytics and want to collect data for a Google Analytics 4 property using Google Tag Manager. For basic information on how to collect GA4 data using Google Tag Manager, read this article.

Tag types

Universal Analytics has only one tag type (Universal Analytics), whereas Google Analytics 4 has two tag types: Google Analytics: GA4 Configuration and Google Analytics: GA4 Event

  • The GA4 Event tag references the GA4 Configuration tag and therefore depends on the GA4 Configuration tag being set up.
  • At runtime, the GA4 Configuration tag must fire before the GA4 Event tag.

To ensure that the GA4 Configuration tag is fired before the GA4 Event tag, assign a GA4 Configuration tag trigger that is guaranteed to be earlier than the GA4 Event tag’s trigger.

Persist settings across events

Universal Analytics makes use of a “Google Analytics Settings” variable to persist tag settings (e.g. tracking ID, cookie domain, or disable advertising features) that need to be consistent across Universal Analytics tags. You can similarly persist settings across GA4 Event tags using the GA4 Configuration tag. GA4 Event tags inherit the parameters and user properties of the linked GA4 Configuration tag.

Interaction between on-page gtag.js code and Tag Manager GA4 tags

If you have both a gtag.js implementation and a Tag Manager GA4 implementation on the same page, the on-page gtag.js code may have an impact on the Tag Manager GA4 tags. Some settings parameters, such as “cookie_prefix”, or “allow_ad_personalization_signals”, assigned via the on-page gtag('set', paramName, paramValue) command will propagate the parameters to GA4 tags fired from Tag Manager.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
14690996739154993204
true
Search Help Center
true
true
true
true
true
69256
false
false
  翻译: