Google Tag Manager allows you to set up and manage GA4 events all in one place. To send event data from Google Tag Manager to GA4, you need two tags that work together:
Google tag
The Google tag establishes the data flow from your website to Google Analytics and other destinations you might have set. Create one Google tag per domain and place it on every site that you want to measure.Google Analytics: GA4 Event
The GA4 Event tag lets you set up events on your website without writing code. The event data shows up in your GA4 reports.
Create as many event tags as you need to measure your recommended or custom events.
The steps below will help you configure this.
Before you begin
This guide assumes that you've done the following:
It also assumes that you have the following:
Access to the Tag Manager container for the website
The Editor (or above) role to the Google Analytics account
Set up the Google tag
Step 1: Create a Google tag
Start by creating a Google tag to send data to your Analytics property.
Select the container you want to configure. Open the Tags menu.
Create a New tag. Enter a name for the tag at the top (e.g., "Google tag configuration - example.com").
In the Tag Configuration box, select Google tag.
Configure your tag. In the field Tag ID, enter your Google tag ID. If you don't know how to find this, follow this link for more details.
Click on triggering and select "All pages"
While on the main screen in your Google Tag Manager, copy your Google Tag Manager ID and paste it into your Momence general settings as shown below:
Step 2: Purchase event tracking
You can go one step further and also track purchase events - fired whenever someone purchases something on your checkout pages. That will allow you to see monetization metrics in your GA4.
First, navigate to the variables section and click on "New" to create a new user-defined variable.
We are going to create 3 different variables. Each one will have a different name listed below, and the variable configuration will be set to "Data Layer Variable".
The first one called "Data Layer - GA4 Ecommerce value", and whose Data Layer Variable Name will be set to "ecommerce.value".
The second one one called "Data Layer - GA4 Ecommerce items", and whose Data Layer Variable Name will be set to "ecommerce.items".
The third one called "Data Layer - GA4 Ecommerce currency", and whose Data Layer Variable Name will be set to "ecommerce.currency".
After this, you will navigate to the Tags section, and will create a new tag.
Name the tag "GA4 - Purchase" and in the tag configuration select Google Analytics > Google Analytics: GA4 Event.
Introduce your GA4 Measurement ID in the corresponding field, and in the event name field type "purchase".
next, open up the event parameters section, and click add parameter to add the three parameters below:
Scroll down to More settings, open it up, and toggle on the "Send Ecommerce data" option. Make sure it's set to "Data Layer".
Last, click on the Triggering section, and create a new trigger clicking on the "+" sign.
Name the trigger "Purchase Event Trigger", and click on the configuration section. Select "Custom Event" and name it "purchase".
Once your tag looks as below, click save, and Submit your workspace changes.
Step 3: Cross-domain tracking
In order for the purchase tracking to work, you need to preserve the user session between your site and Momence. For this, you will need to set up cross-domain tracking. There are a few steps to be taken:
While in Google Analytics, navigate to admin clicking the wheel cog on the bottom left corner. Pick Data collection and modification, and click Data streams.
Click Web, then click a web data stream.
In the web stream details, click Configure tag settings (at the bottom).
In the Settings section, click Configure your domains.
Click Add condition and select "Contains" as the match type, and type momence.com in the domain field.
Click Save.