Google Analytics 4 - Collect

📘

This integration is currently in beta. Contact your MetaRouter support team to get started.

What Is Google Analytics 4 - Collect?

Google Analytics 4, commonly referred to as GA4, is the latest iteration of Google's web analytics platform, designed to provide deeper insights into user behavior across websites and apps. It offers a more holistic approach to analytics by integrating data from various touchpoints, including websites, mobile apps, and other digital platforms. GA4 focuses on user-centric measurement, emphasizing the importance of understanding individual user journeys and interactions.

MetaRouter has two integrations for GA4. The GA4 - Collect integration uses the collect endpoint for data and measurement, and it is the recommended integration for GA4. For more information about Google Analytics 4- Measurement, please see here.


Google Analytics 4 - Collect Endpoint vs Measurement Protocol

Collect Endpoint:

  • More data accuracy in
    • Age demographic
    • Page count
    • Session start events
  • Cannot collect screen resolution data

Measurement Protocol:

  • Can collect screen resolution data
  • More data on device category

Important Notes & Limitations

  • Enable Google Ads auto-tagging for Google Ads reporting.
    • Auto-tagging automatically imports Google Ads data into Analytics. Combining Google Ads data with the rich post-click information provided by Analytics allows you to see what happened on your site after people clicked on your ads. When you enable auto-tagging, a parameter called gclid is added to your landing page URL when a user clicks over to your site from an ad.
  • No user engagement reporting.
  • Cross network reporting may not be present in user and traffic acquisition reports.

Getting Started - From Your Google Analytics Account

Obtain your Measurement ID

  1. Log in to your Google Analytics account.
  2. Navigate to the Admin section.
  3. In the “Property settings” column, expand “Data collection and modification”, click on "Data Streams."
  4. Here, you'll find a list of data streams associated with the property.
  5. Click on the data stream for which you want to find the measurement ID.
  6. The measurement ID is displayed at the top of the page. Ex, “G-XXXXX00000”.

Getting Started - From Your MetaRouter Account

Adding a Google Analytics - Collect integration.

From the integration library, add a Google Analytics 4 (Collect) integration. Then, fill out the Connection Parameters:

Connection ParameterDescription
MEASUREMENT_IDThe GA4 measurement ID is a unique identifier assigned to each Google Analytics 4 property, allowing data to be collected and associated with that specific property.


Adding a Google Gtag Sync

To gather the cid, gclid (Google click ID) value, dclid (Display click ID) value, session ID, and session count, you must add a Google Gtag sync.

  1. From the Pipelines page, find the pipeline associated with the web property you’d like to add a sync to. Hover over the three dot dropdown and select “Build AJS File.”
  2. In the Identity Syncs section, select the Google Gtag sync.
  3. Fill out the following fields:
    1. GTAG.js Tag ID - The Tag ID in GA4, also known as the Measurement ID, can be found in Data Streams. Alternatively, you can find it in your GTAG settings. Examples of Tag IDs include GT-XXXXXXXXX, G-XXXXXXXXX, and AW-XXXXXXXXX. For more information on locating the GTAG.js Tag ID, please refer to this guide
    2. Destination IDs - Allows the sync to connect and direct events to the correct Google product. For Google Ads, the destination ID is the same as the conversion tracking ID, for example AW-98765.
    3. Floodlight Advertiser ID Object - The Floodlight Advertiser ID. This is not required for the Google Ads integration, but it is used for other Google integrations such as Campaign Manager.
    4. Cookie Lifetime (in days) - 45 days default
    5. Fire on Re-sync - Re-syncs for an updated identifier when an Identify call is made.
    6. Send MetaRouterSync to GA4 - Sends a MetaRouterSync event to GA4 when the sync is loaded on the page.
    7. Enable Google Consent Mode - If enabled, consent categories 'ad _storage, 'ad_user_data', 'ad _personalization', 'analytics_storage' will be sent to Google when user is opt-in or opt -out
    8. Advanced Consent Mode Type (when consent mode is enabled) - If consent mode is enabled, the consent mode will be set to advanced' when this is on, and 'basic' when this is off
  4. Scroll down and click the Save and Build File button.
  5. Deploy your AJS file to propagate changes to your web property.

Event Mappings

MetaRouter provides all of the event mappings that Google integrations typically require. You may add custom events, parameters or mappings in accordance with Google Analytics 4 - Collect’s API documentation.

Global

Global mappings will be applied to all events. If your parameter names do not match the Expected Inputs provided, you will need to overwrite the Inputs provided with your own.

Output KeyDescriptionExpected Input
gclidType: String
Specifies the Google Ad Id.
context.providers.googleGtag.data.gclid
dclidType: String
Specifies the Google Display Ads Id.
context.providers.googleGtag.data.dclid
cid
Required
Type: String
Client ID.
N/A - Expression
dlType: String
Page URL.
context.page.url
dtType: String
Page title.
context.page.title
drType: String
Page referrer.
context.page.referrer
ua
Highly Recommended
Type: String
User agent, required if platform data is needed.
context.userAgent
_uip
Highly Recommended
Type: String
User IP address, required if geolocation data is needed.
context.ip
ciType: String
Campaign ID.
context.campaign.id
csType: String
Campaign source.
context.campaign.source
cmType: String
Campaign medium.
context.campaign.medium
cnType: String
Campaign name.
context.campaign.name
ccType: String
Campaign conent.
context.campaign.content
ckType: String
Campaign term.
context.campaign.term
sid
Highly Recommended
Type: String
Session ID, required if session data is needed.
context.providers.googleGtag.data.sessionID
sct
Highly Recommended
Type: Integer
Session count, required if session data is needed.
context.providers.googleGtag.data.sessionCount
_et
Required
Type: Integer
Engagement time in milliseconds: currently hardcoded to 1
N/A - Expression
tid
Required
Type: String
Tracking ID, otherwise known as Measurement ID in GA4.
Enrichment - MEASUREMENT_ID
v
Required
Type: Integer
Must equal 2.
Enrichment - 2
isDebugModeType: Boolean
Must be true.
Enrichment - true


Event Specific

page

Output KeyDescriptionExpected Input
en
Required
Type: String
Event name.
Enrichment - page_view
isConversionType: Boolean
Mark true if event is a conversion.
Enrichment - true

cart_viewed

Output KeyDescriptionExpected Input
cuType: String
Currency of the purchase or items associated with the event, in 3-letter ISO_4217 format.
properties.currency
epn-valueType: Number
Monetary value of the event that occurred.
N/A - Expression
en
Required
Type: String
Event name.
Enrichment - view_cart

product_added

Output KeyDescriptionExpected Input
cuType: String
Currency of the purchase or items associated with the event, in 3-letter ISO_4217 format.
properties.currency
epn-valueType: Number
Monetary value of the event that occurred.
N/A - Expression
pr1Type: String
Product information.
N/A - Expression
isConversionType: Boolean
Mark true if event is a conversion.
Enrichment - true
en
Required
Type: String
Event name.
Enrichment - add_to_cart

order_refunded

Output KeyDescriptionExpected Input
cuType: String
Currency of the purchase or items associated with the event, in 3-letter ISO_4217 format.
properties.currency
ep-transaction_idType: String
The unique identifier of a transaction.
properties.order_id
ep-couponType: String
The coupon name or code associated with an event.
properties.coupon
epn-valueType: Number
Monetary value of the event that occurred.
N/A - Expression
epn-taxType: Number
The tax cost associated with a transaction.
properties.tax
epn-shippingType: Number
The shipping cost associated with a transaction.
properties.shipping
en
Required
Type: String
Event name.
Enrichment - ``

product_viewed

Output KeyDescriptionExpected Input
cuType: String
Currency of the purchase or items associated with the event, in 3-letter ISO_4217 format.
properties.currency
epn-valueType: Number
Monetary value of the event that occurred.
N/A - Expression
pr1Type: String
Product information.
N/A - Expression
isConversionType: Boolean
Mark true if event is a conversion.
Enrichment - true
en
Required
Type: String
Event name.
Enrichment - view_item

order_completed

Output KeyDescriptionExpected Input
cuType: String
Currency of the purchase or items associated with the event, in 3-letter ISO_4217 format.
properties.currency
ep-transaction_idType: String
The unique identifier of a transaction.
properties.order_id
ep-couponType: String
The coupon name or code associated with an event.
properties.coupon
epn-valueType: Number
Monetary value of the event that occurred.
N/A - Expression
epn-taxType: Number
The tax cost associated with a transaction.
properties.tax
epn-shippingType: Number
The shipping cost associated with a transaction.
properties.shipping
isConversionType: Boolean
Mark true if event is a conversion.
Enrichment - true
en
Required
Type: String
Event name.
Enrichment - purchase

product_clicked

Output KeyDescriptionExpected Input
pr1Type: String
Product information.
N/A - Expression
en
Required
Type: String
Event name.
Enrichment - select_item

product_removed

Output KeyDescriptionExpected Input
cuType: String
Currency of the purchase or items associated with the event, in 3-letter ISO_4217 format.
properties.currency
epn-valueType: Number
Monetary value of the event that occurred.
N/A - Expression
pr1Type: String
Product information.
N/A - Expression
en
Required
Type: String
Event name.
Enrichment - remove_from_cart

checkout_started

Output KeyDescriptionExpected Input
cuType: String
Currency of the purchase or items associated with the event, in 3-letter ISO_4217 format.
properties.currency
ep-transaction_idType: String
The unique identifier of a transaction.
properties.order_id
ep-couponType: String
The coupon name or code associated with an event.
properties.coupon
epn-valueType: Number
Monetary value of the event that occurred.
N/A - Expression
epn-taxType: Number
The tax cost associated with a transaction.
properties.tax
epn-shippingType: Number
The shipping cost associated with a transaction.
properties.shipping
en
Required
Type: String
Event name.
Enrichment - begin_checkout

promotion_viewed

Output KeyDescriptionExpected Input
ep-creative_nameType: String
The name of a creative used in a promotion.
properties.creative
ep-creative_slotType: String
The name of the promotional creative slot associated with an event.
properties.position
ep-promotion_idType: String
The ID of the promotion associated with an event.
properties.promotion_id
ep-promotion_nameType: String
The name of the promotion associated with an event.
properties.name
en
Required
Type: String
Event name.
Enrichment - view_promotion

products_searched

Output KeyDescriptionExpected Input
ep-search_termType: String
The term that was searched for.
properties.query
en
Required
Type: String
Event name.
Enrichment - search

promotion_clicked

Output KeyDescriptionExpected Input
ep-creative_nameType: String
The name of a creative used in a promotion.
properties.creative
ep-creative_slotType: String
The name of the promotional creative slot associated with an event.
properties.position
ep-promotion_idType: String
The ID of the promotion associated with an event.
properties.promotion_id
ep-promotion_nameType: String
The name of the promotion associated with an event.
properties.name
en
Required
Type: String
Event name.
Enrichment - select_promotion

product_list_viewed

Output KeyDescriptionExpected Input
ep-item_list_idType: String
The ID of the list in which the item was presented to the user.
properties.list_id
ep-item_list_nameType: String
The name of the list in which the item was presented to the user.
properties.category
en
Required
Type: String
Event name.
Enrichment - view_item_list

payment_info_entered

Output KeyDescriptionExpected Input
cuType: String
Currency of the purchase or items associated with the event, in 3-letter ISO_4217 format.
properties.currency
ep-couponType: String
The coupon name or code associated with an event.
properties.coupon
ep-payment_typeType: String
The chosen method of payment.
properties.payment_method
epn-valueType: Number
Monetary value of the event that occurred.
N/A - Expression
en
Required
Type: String
Event name.
Enrichment - add_payment_info

product_added_to_wishlist

Output KeyDescriptionExpected Input
cuType: String
Currency of the purchase or items associated with the event, in 3-letter ISO_4217 format.
properties.currency
epn-valueType: Number
Monetary value of the event that occurred.
N/A - Expression
pr1Type: String
Product information.
N/A - Expression
en
Required
Type: String
Event name.
Enrichment - add_to_wishlist

Required & Recommended Identifiers

These identifiers must be mapped to Google Analytics 4 - Collect in order for successful user matching to occur. Without these IDs, any events sent to Google Analytics 4 - Collect will not appear in your dashboard. For your convenience, required and recommended IDs are mapped as Global parameters to ensure they are added to every event.

AttributeExampleSync Injector Required?
cid
Required
35009a79-1a05-49d7-b876-2b884d0f825bYes
ua
Highly Recommended
Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14No
uip
Highly Recommended
1.2.3.4No
sid
Highly Recommended
AJKDLSJFKLJ2390SKDFJLKJ23KJF9Yes
sct
Highly Recommended
620Yes

Additional Identifiers

These identifiers should be mapped to Google Analytics 4 - Collect whenever possible to ensure the highest user match rates possible. If using these identifiers, they must be added as Global or Event Specific mappings.

AttributeDescriptionExample
gclidA Google Click Identifier generated by Google Ads or Search Ads 360.&gclid=CjwKCAjwt-OwBhBnEiwAgwzrUkyNMRwtorgWNStUyWMG50WbzKNMWAFeWOHtq5q0cEbAHYKX7a4hNBoCwugQAvD_BwE
dclidConversions can be attributed to ad clicks through the use of Display Click IDs (DCLIDs), typically used for DV360 conversions.&dclid=CKDdz-fE_IUDFYtTCQkdbyMOPg

Additional Google Analytics 4 - Collect Documentation