The way events are handled within Analytics 4 is different from the older version. Therefore you will need to create a new configuration. Currently, Datatrics is only compatible with GA4 integrations that have been configured with Google Tag Manager. This document describes the steps how to do this.

First, head over to your GTM container.

Go to the variables section and create the following variables:

  • event

    Type: Custom Event

  • eventAction

    Type: Data Layer Variable

    Data Layer Variable Name: eventAction

  • eventCategory

    Type: Data Layer Variable

    Data Layer Variable Name: eventCategory

  • eventLabel

    Type: Data Layer Variable

    Data Layer Variable Name: eventLabel

  • eventValue

    Type: Data Layer Variable

    Data Layer Variable Name: eventValue

  • Datatrics Group

    Type: Data Layer Variable

    Data Layer Variable Name: dtgroup

  • Datatrics Segment

    Type: Data Layer Variable

    Data Layer Variable Name: segmentid

  • Datatrics Journey (optional)

    Type: Data Layer Variable

    Data Layer Variable Name: journeyid

  • Datatrics Buying Phase (optional)

    Type: Data Layer Variable

    Data Layer Variable Name: buyingphase

  • Datatrics Campaign (optional)

    Type: Data Layer Variable

    Data Layer Variable Name: campaignid

  • Datatrics Persuasion (optional)

    Type: Data Layer Variable

    Data Layer Variable Name: persuasion

  • Datatrics Customer Type (optional)

    Type: Data Layer Variable

    Data Layer Variable Name: customertype

  • Datatrics Touchpoint (optional)

    Type: Data Layer Variable

    Data Layer Variable Name: touchpoint

  • Datatrics Touchpoint Content (optional)

    Type: Data Layer Variable

    Data Layer Variable Name: content

Next up, create a new trigger:

Name: DatatricsEvent - Only touchpoint

Event name:
DatatricsEvent
This trigger fires on:
EventAction - contains - touchpoint


After you've performed these steps, save the trigger.

Now head over to the tags section, and create a new Google Analytics 4 tag.

Name: Datatrics - GA4 Events
Configuration type: Google Analytics 4
Event name: datatrics_touchpoint
Event parameters
parameter name & value:
event_action: {{eventAction}}
event_label: {{eventLabel}}
event_value: {{eventValue}}
User properties
property Name & value:
datatrics_group: {{Datatrics- Group}}
datatrics_segment: {{Datatrics - Segment}}
-- add other optional propertynames based on the variables.

Now head over to the Google Analytics 4 property

Go to configure --> Custom definitions

Create a new custom definition for the Datatrics groups:

Create a new custom definition for the Datatrics segments and other variables that you want to show:


After this has been done, go to configure --> audiences.

Click on create a new audience, give the segment a fitting name, like:
Datatrics group - hide
Datatrics group - show

Select datatrics_group - contains - show.

After performing this action, create another segment for the hide group.

When the above has been performed, you can see the Datatrics A/B Testing groups in Google Analytics 4 and compare them.

Did this answer your question?