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.

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:



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:


For the Event Name use pageview


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.

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:


  • view_item
  • add_to_cart
  • remove_from_cart
  • begin_checkout
  • purchase

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



Choose tag type: Google Analytics: GA4 Event:



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:



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



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



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:


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: