This article describes how to set up the Google Analytics 4 tag (GA4) in your Tealium iQ Tag Management account.

In this article:

Overview

The Google Analytics 4 tag can only be used with GA4 properties. You cannot use the GA4 tag with a Universal Analytics property. However, you can use both the UA and GA4 tags on the same website. Your new GA4 property won't have historical data, so it is recommended that you run both GA4 and Universal Analytics in parallel for a few months before switching to GA4.

GA4 has a different structure for events than Google Univeral Analytics. GA4 is event-based with parameters and properties, and does not use event_category, event_action, event_label, or custom dimensions.

For more information on setting up a GA4 property and migrating to GA4 from Universal Analytics, see Next Generation of Google Analytics and Migrating from Universal Analytics to Google Analytics 4.

Automatic and Recommended Events

GA4 automatically generates some events, with no setup required, For more information on these automatically generated events and their parameters, see Google Analytics 4 Automatically Collected Events.

GA4 also has recommended events in the following categories:

  • All sites and apps
  • Retail and ecommerce
  • Jobs, education, local deals, and real estate
  • Travel
  • Games

For recommended events, data must be mapped to the event parameters. For more information on recommended events and their parameters, see [GA4] Recommended Events.

Configuring the Google Analytics 4 Tag

Go to the tag marketplace and add the Google Analytics 4 tag. For information on adding a tag, see Tags.

After adding the tag, configure the following settings:

  • Measurement ID
    • Measurement ID of the Google Analytics property for which you want to send data. The measurement ID begins with "G-". For example, G-12345678M.
    • Use a comma-separated list of measurement IDs to send data for multiple GA4 properties.
  • Global Object
    • The name of the Global Object used for the event queue.
    • If not specified, gtag is used.
    • Not required for most implementations.
  • Data Layer Name
    • By default, the data layer initiated and referenced by the global site tag is named dataLayer.
    • Rename the data layer only if your project requires a separate name.
  • Send Page View
    • By default, Page View events are automatically recorded for each page on your site.
    • If you do not want to send Page View events to Google Analytics, set this option to false.
  • Clear Vars
    • Clears items usually set for the lifetime of the tracker after each tracking request.

Page View Events with Custom Parameters

Page view events are automatically sent by the GA4 tag, which means no additional data can be sent with these events. However, you can set Send Page View to False, then map a page view event that is triggered when tealium_event = view and send custom parameters with that event. Other automatic events can be disabled in the GA4 interface.

Items Parameter for Recommended Events

Some travel events and retail and ecommerce events have an items parameter. For these events, the items array is automatically populated from E-commerce Extension values, such as product name, category, and price.

For more information, see E-commerce Extension.

Custom Events

If you are using Google Universal Analytics and have custom events and dimensions you want to use with GA4, these custom events need to be reconfigured for GA4 due to differences in the event structure for Univeral Analytics and GA4. GA4 is event-based and requires data to be mapped to event parameters.

For more information, see Migrating from Universal Analytics to Google Analytics 4.

Data Mappings

Mapping is the process of sending data from a data layer variable to the corresponding destination variable of the vendor tag. For instructions on how to map a variable to a tag destination, see Data Mappings.

Mapping Custom Events

Before creating a custom event, make sure there are no automatically generated events or recommended events for your use case. If you create a custom event, it does not appear in the default GA4 reports. You need to set up custom reports that include custom events.

To create a custom event, you typically map a data layer variable that captures event names. The example shown here uses tealium_event. The Trigger is the value of that data layer variable that corresponds to the event you want to track. The Custom Name is the GA4 custom event name. For example, if your data layer has the following custom event:

var utag_data = { "tealium_event" : "my_event_name" };

Then the mapping for GA4 would look like this:

GA4-data-mapping-custom-event.png

Mapping Form Submit Events

Mapping form submit events is similar to mapping a custom event. For example:

form-submit-mapping.png

Google Analytics 4 Variables Available for Mapping

The following sections list the GA4 variables by the categories in the Data Mappings tab of the Tag Configuration dialog.

Standard

Variable Description

measurement_id

  • Measurement ID

clear_global_vars

  • Boolean
  • Clear Vars
cookie_domain (config.cookie_domain)
cookie_expires (config.cookie_expires) [Integer]
cookie_prefix (config.cookie_prefix)
cookie_update (config.cookie_update) [Boolean]
cookie_flags (config.cookie_flags)
send_page_view (config.send_page_view) [Boolean]
Allow Advertising Features (config.allow_google_signals) [Boolean]
Allow Advertising Personalizations (config.allow_ad_personalization_signals) [Boolean]
Transport Type (config.transport_type)
page_title (config.page_title)
page_location (config.page_location)
page_path (config.page_path)
cookie_name (config.cookie_name)
Campaign Id (config.campaign.id)
Campaign Name (config.campaign.name)
Campaign Source (config.campaign.source)
Campaign Medium (config.campaign.medium)
Campaign Content (config.campaign.content)
Campaign Term/Keyword (config.campaign.term)
Optimize Container ID (config.optimize_id)
Use AMP Client ID (config.use_amp_client_id) [Boolean]
Sample Rate (config.sample_rate)
Site Speed Sample Rate (config.site_speed_sample_rate)
User ID (customer_id) (Overrides _ccustid)
Client ID (config.client_id)

Event

Variable Description
Event Category (event.event_category)
Event Label (event.event_label)
Event / Timing Value (value)
Timing Variable Name (name)
Exception Description (description)
Exception Fatal (fatal) [Boolean]
Search Term (search_term)
Method (method)
Content Type (content_type)
Content ID (content_id)
Destination (destination)
Start Date (start_date) [YYYYMMDD]
End Date (end_date) [YYYYMMDD]
Custom Event Data (event.custom)
Non-Interaction (event.non_interaction)
Override Default Routing (event.send_to)
Event Callback (event.event_callback)

Event Triggers

Variable Description
exception exception
generate_lead generate_lead
join_group join_group
login login
Page View page_view
screen_view screen_view
search search
select_content select_content
share share
sign_up sign_up
timing_complete timing_complete
add_payment_info add_payment_info
add_shipping_info add_shipping_info
add_to_cart add_to_cart
add_to_wishlist add_to_wishlist
begin_checkout begin_checkout
purchase purchase
refund refund
remove_from_cart remove_from_cart
select_item select_item
select_promotion select_promotion
view_cart view_cart
view_item view_item
view_item_list view_item_list
view_promotion view_promotion
earn_virtual_currency earn_virtual_currency
level_end level_end
level_start level_start
level_up level_up
post_score post_score
spend_virtual_currency spend_virtual_currency
tutorial_begin tutorial_begin
tutorial_complete tutorial_complete
unlock_achievement unlock_achievement
Custom Event customEvent

Game

Variable Description
Achievement Id (achievement_id)
Character (character)
Group Id (group_id)
Item Name (item_name)
Level (level)
Level Name (level_name)
Score (score)
Success (success)
Virtual Currency Name (virtual_currency_name)
Virtual Currency Value (value)

App / Screen Tracking

Variable Description
Screen Name (screen_name)
Application Name (config.app_name)
Application ID (config.app_id)
Application Version (config.app_version)
Application Installer ID (config.app_installer_id)

Enhanced E-Commerce

Variable Description
Order ID (order_id) (Overrides _corder)
Order Total (order_total) (Overrides _ctotal)
Shipping Amount (order_shipping) (Overrides _cship)
Tax Amount (order_tax) (Overrides _ctax)
Store (order_store) (Overrides _cstore)
Currency (order_currency) (Overrides _ccurrency)
Promo Code (order_coupon_code) (Overrides _cpromo)
List of Product IDs (product_id) (Overrides _cprod) [Array]
List of Names (product_name) (Overrides _cprodname) [Array]
List of SKUs (product_sku) (Overrides _csku) [Array]
List of Brands (product_brand) (Overrides _cbrand) [Array]
List of Categories (product_category) (Overrides _ccat) [Array]
List of Sub Categories (product_subcategory) (Overrides _ccat2) [Array]
List of Quantities (product_quantity) (Overrides _cquan) [Array]
List of Prices (product_unit_price) (Overrides _cprice) [Array]
List of Discounts (product_discount) (Overrides _cpdisc) [Array]
List of Promotion Ids (product_promotion_id) [Array]
List of Promotion Names (product_promotion_name) [Array]
List of Creative Names (product_creative_name) [Array]
List of Creative Slots (product_creative_slot) [Array]
List of Location Ids (product_location_id) [Array]
List of Indexes (product_index) [Array]
List of Item List Names (product_item_list_name) [Array]
List of Item List Ids (product_item_list_id) [Array]
List of Affiliations (product_affiliation) [Array]

IAB Transparency and Consent Framework v2

Variable Description
Enable TCF Support (gtag_enable_tcf_support) (true/false)
Public