Pre-requisite: Pathmonk must first be integrated through Google Tag Manager.
How to Send Pathmonk Data to GA4
Follow these steps sequentially to successfully send Pathmonk data into your GA4 account.
1. Create 3 Events in GA4
Pathmonk analyzes 3 different groups in A/B testing:
- Pathmonk Control: Visitors Pathmonk is just tracking. (
pathmonk_analytics_only
) - Pathmonk Disabled: Visitors who did not see Pathmonk's micro-experiences. (
pathmonk_not_displaying
) - Pathmonk Variation: Visitors who saw Pathmonk micro-experiences. (
pathmonk_displaying
)
To create these 3 events in GA4:
- Go to Admin.
- Under Data Display, click Events.
- On the top right, click Create Event.
- Click Create again.
- Under Custom Name, name the event according to the group you are creating (e.g.,
pathmonk_not_displaying
). - Set Matching Conditions:
- Parameter: Event
- Operator: Equals
- Value: pathmonk_not_displaying
- Click Save.
- Repeat this process for the other two groups:
pathmonk_analytics_only
andpathmonk_displaying
.
2. Set Up Tags in Google Tag Manager
You will need to set up 4 tags.
Tag 1: Create an Event Listener to Fire Before the Pathmonk Tag
To set up the tag:
Click on the Tags tab.
Click on New.
Name the tag, e.g.,
[SETUP] Listen to Pathmonk Events
.Click on Tag Configuration.
Select Custom HTML Tag.
Paste the following script:
<script> document.addEventListener("pathmonkControlGroupPathmonk", function(event) { window.dataLayer.push({ 'event': 'pathmonk_displaying', 'pathmonk_user': "pathmonk_displaying"}); }); document.addEventListener("pathmonkControlGroup", function(event) { window.dataLayer.push({ 'event': 'pathmonk_not_displaying', 'pathmonk_user': "pathmonk_not_displaying"}); }); document.addEventListener("pathmonkControlGroupDisabled", function(event) { window.dataLayer.push({ 'event': 'pathmonk_analytics_only', 'pathmonk_user': "pathmonk_analytics_only"}); }); </script>
To create a trigger:
- Select Trigger.
- Choose All Pages and save.
Go to the tag where you have the Pathmonk SDK code:
- Click on the tag.
- Select Tag Sequencing.
- Click on Fire a tag before the Pathmonk SDK code Tag.
- Set up the tag: Select the
[SETUP] Listen to Pathmonk Events
tag you created. - Save.
Tag 2: Set Up Tags for Each Pathmonk Group
To set up each tag:
- Click on the Tags tab.
- Click on New.
- Name the tag, e.g.,
[GA4] pathmonk_displaying
. - Click on Tag Configuration.
- Select Google Analytics: GA4 Event.
- Add your GA4 measurement ID. G-RCQF1NQPZG
- Add the event name, e.g.,
pathmonk_displaying
. - Under More Settings, select Send eCommerce Data.
- Set Data Source to Data Layer.
To create a trigger:
- Select Trigger Type: Custom Event.
- Name it, e.g.,
pathmonk_displaying
. - Set This Trigger Fires On Custom Events.
- Set up conditions: Event equals
pathmonk_displaying
. - Save.
Tag 3 and 4: Repeat this process for the other two groups: pathmonk_not_displaying
and pathmonk_analytics_only
.
Final Step: Organize Your Tags
- Add all Pathmonk-related tags to a Pathmonk Setup Folder.
After all these items are completed, feel free to test if the GA4 events are happening in real-time on your GA4.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article