GA4 (Google Analytics 4) via Google Tag Manager

On July 1, 2023, standard Universal Analytics properties will no longer process data. New data will only flow into Google Analytics 4 properties. You will need to setup your GA4 using Google Tag Manager in Dispense. Learn more

1) Configure Google Analytics 4 tags in Google Tag Manager

Here's Google's documentation on setting up GA4 with Google Tag Manager. Use this article for additional reference, but we'll outline the steps needed below.

https://support.google.com/tagmanager/answer/9442095?hl=en&ref_topic=6333310

Setting up a new GA4 propety

After setting up your GA4 property or migrating your existing UA account to GA4, you will first need to set up your data stream. Go to Data Streams and add a new stream

Input your URL and name the data stream

Copy your measurement ID. This is an alphanumeric value. You will need this when configuring GA4. 

Add Page View Event

First we'll need to configure our GA4 tag. Go to your tags and click on the Google Analytics: GA4 Configuration tag:

Screen_Shot_2023-02-26_at_3.14.55_PM.png

 

Click on Triggering and then hit the plus sign in the top right to add a new Trigger. Click on Trigger Configuration and select Custom Event:

Screen_Shot_2023-02-26_at_3.18.40_PM.png

For the Event Name use pageview

Screen_Shot_2023-02-26_at_3.19.34_PM.png

Save your trigger configuration.

 

2) Set up Google Analytics 4 events with Tag Manager

Here's Google's documentation on setting up GA4 Events with Google Tag Manager. Use this article for additional reference, but we'll outline the steps needed below.

https://support.google.com/tagmanager/answer/9442095?hl=en&ref_topic=https://support.google.com/tagmanager/answer/13034206?hl=en&ref_topic=6333310

Dispense supports GA4's e-commerce events. These are pre-defined events that GA4 will recognize. We're going to add each of the following events in GTM:

Events

  • view_item
  • add_to_cart
  • remove_from_cart
  • begin_checkout
  • purchase

Go to the Tags section in GTM and add a new tag:

Screen_Shot_2023-02-27_at_8.52.27_AM.png

 

Choose tag type: Google Analytics: GA4 Event:

Screen_Shot_2023-02-27_at_8.52.52_AM.png

 

Configure the new tag with the event name, we'll start with "view_item". Be sure to select "Send Ecommerce Data" under the "More Settings" section:

Screen_Shot_2023-02-27_at_8.53.12_AM.png

 

Click on "Triggering" and select "Custom Event":

Screen_Shot_2023-02-27_at_8.54.58_AM.png

 

Enter "view_item" for the event name. Your final tag configuration should look like this:

Screen_Shot_2023-02-27_at_8.55.13_AM.png

 

Save your new GA4 event in GTM. Follow these steps for each of the outlined events.

 

Wrapping Up

Your GTM Tags should look like this once you've complete setting up GTM tags for all of the outlined events:

Screenshot_2023-02-28_at_7.21.30_PM.png

Publish GTM container:

After you are finish setting up your events/triggers and it looks like the image above, you will want to publish your container. 

Submit > Publish and Create Version
Publish to Environment: Live

Add GTM container ID to Dispense:

If you don't already have GTM enabled in Dispense, you will need to setup that integration. If you do already have it enabled, you can skip this step. 

Go to workspace in GTM and grab your GTM number (container ID) on the top right corner. Take the container ID and add it to your Dispense GTM integration panel. 

Verifying your setup:

Log in to your GA4 account and go to the Realtime page. You should see data flowing from GTM into your GA4 account now:

Screen_Shot_2023-02-27_at_8.58.55_AM.png