Skip to main content
All CollectionsIntegrationsMarketing
Google Analytics (GA4) Tracking with Google Tag Manager
Google Analytics (GA4) Tracking with Google Tag Manager
Juan avatar
Written by Juan
Updated over a week ago

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.

  1. Select the container you want to configure. Open the Tags menu.

  2. Create a New tag. Enter a name for the tag at the top (e.g., "Google tag configuration -").

  3. In the Tag Configuration box, select Google tag.

  4. 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.

  5. Click on triggering and select "All pages"

  6. 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.

  1. First, navigate to the variables section and click on "New" to create a new user-defined variable.

  2. 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".

    1. The first one called "Data Layer - GA4 Ecommerce value", and whose Data Layer Variable Name will be set to "ecommerce.value".

    2. The second one one called "Data Layer - GA4 Ecommerce items", and whose Data Layer Variable Name will be set to "ecommerce.items".

    3. The third one called "Data Layer - GA4 Ecommerce currency", and whose Data Layer Variable Name will be set to "ecommerce.currency".

  3. After this, you will navigate to the Tags section, and will create a new tag.

  4. Name the tag "GA4 - Purchase" and in the tag configuration select Google Analytics > Google Analytics: GA4 Event.

  5. Introduce your GA4 Measurement ID in the corresponding field, and in the event name field type "purchase".

  6. next, open up the event parameters section, and click add parameter to add the three parameters below:

  7. Scroll down to More settings, open it up, and toggle on the "Send Ecommerce data" option. Make sure it's set to "Data Layer".

  8. Last, click on the Triggering section, and create a new trigger clicking on the "+" sign.

  9. Name the trigger "Purchase Event Trigger", and click on the configuration section. Select "Custom Event" and name it "purchase".

  10. 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:

  1. 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.

  2. Click Web, then click a web data stream.

  3. In the web stream details, click Configure tag settings (at the bottom).

  4. In the Settings section, click Configure your domains.

  5. Click Add condition and select "Contains" as the match type, and type in the domain field.

  6. Click Save.

Did this answer your question?