Integrate GA4 with Elevar
Last updated
Was this helpful?
Last updated
Was this helpful?
Before integrating GA4 with Shoplift and configuring the necessary tags, triggers, and variables in Google Tag Manager, make sure you have the following:
A Google Tag Manager (GTM) account with a container and Google tag configured for your store
Elevar-specific configurations in Google Tag Manager, like the dl_user_data
event and user_data
triggers
Access to the Google Analytics property for your store to authorize the connection in Shoplift
The ability to create Audiences in GA4 via the Google Account you use to authorize the connection
Permissions to publish changes to your Google Tag Manager container
In Shoplift, navigate to Settings and then click the Integrations tab.
Click Connect to open up an authorization window for your Google account, and select the Google account that has access to your GA property from the list.
On the next screen, Shoplift will request permissions to Edit Google Analytics management entities. Click Allow. These permissions will allow Shoplift to create Google Analytics audiences for your tests on your behalf.
Once you've authorized the connection, you will be redirected back to Shoplift, and an account selection dropdown will appear. Select the Google Analytics account for your store from the list.
After selecting an account, a property selection dropdown will appear. Select the property for your store. You can confirm it is the correct property by referencing the Measurement ID in the dropdown, next to each property name (this will be a string of characters, like G-XXXXXXXXXX
).
Once you've selected your property, click Confirm. The integration will toggle on, and your Google Analytics 4 account and Shoplift are now integrated.
In Google Tag Manager, go to Variables, and under User-Defined Variables, click New.
Name your variable exp_variant_string
. Then click Variable Configuration and choose Data Layer Variable from the window.
In the Data Layer Variable Name field, enter exp_variant_string
.
The Data Layer Version will default to Version 2. If it is not, set it to Version 2 from the dropdown.
Click Save to save your new variable.
In Google Tag Manager, go to Tags, and click New to start creating a new tag.
Name your tag Shoplift - GA4 Event.
Click Tag Configuration and select Google Analytics from the list. Then select Google Analytics: GA4 Event.
In the Measurement ID field, enter your Measurement ID for your GA4 property. This will be a string of characters, like G-XXXXXXXXXX
, and should be the same ID that you see connected in Shoplift. If you already have a variable configured for your Measurement ID, you can add the variable instead.
In the Event Name field, enter experience_impression
.
Expand the Event Parameters section and click Add Parameter.
In the Event Parameter field, enter exp_variant_string
.
In the Value field, click the button to add the exp_variant_string
variable you created earlier.
Now click Triggering to add a trigger to this event tag.
Create a new trigger by clicking the + icon in the top right.
Name your trigger User Data + Experience Impression.
Click Trigger Configuration and scroll down in the window until you see the Other section. Select Trigger Group.
Now we'll define the Triggers included in the Trigger Group. This will include a specific Experience Impression event trigger that we will create, and an Elevar-specific User Data event trigger which should already be created in your Tag Manager container.
Click Choose a trigger. Create a new trigger by clicking the + icon in the top right.
Name your trigger Shoplift - GA4 Event Trigger.
Click Trigger Configuration and scroll down in the window until you see the Other section. Select Custom Event.
In the Event name field, enter experience_impression
.
Click Save to save your new event trigger.
Then add another trigger to the trigger group by clicking the + icon.
Select the Elevar User Data event trigger, which will be called something like Event - user_data. To confirm you've selected the correct trigger, you can click into the Elevar trigger to look at it's configuration. The Trigger Type should be Custom Event and the Event name should be dl_user_data
.
Once selected, you will have two triggers in your trigger group.
Click Save to save your trigger. Then click Save again to save your new event tag.
Publish your changes to your workspace by clicking Submit and Publish.
Your Google Tag Manager container and GA4 property are now configured to receive events from Shoplift!