In this article, you’ll learn about the following: |
Google Analytics 4 (GA4) is the latest version of Google Analytics, which is quite different from the traditional “Universal” Analytics. GA4 is driven by events, i.e., events are essential to present data in Google Analytics 4.
One of the advantages of GA4 is that you can use it for a website, an app, or a website and app together. To know more about GA4, refer to the next generation of Google Analytics.
By integrating your VWO account with GA4, you will be able to create GA4 audiences right from VWO and also import your audiences from GA4 to your VWO account.
ATTENTION: Before proceeding, you must first check the installation of the GA4 code present on your website. If it's installed directly on the website, please follow the article Integrating VWO with Google Analytics 4 to set up your VWO-GA4 integration. Use the integration method described in this article only when your GA4 code is installed via GTM on the website.
Integrating VWO With GA4 via GTM
Pushing the VWO campaign data to GA4 via GTM is a four-step process:
- Creating Data Layer Variables in GTM
These variables are used to create tags and define triggers for events to execute. - Creating Triggers for the Event
The firing rules are conditions that evaluate to either fire or not fire an event to the tags. These allow VWO to push test data to GTM.
- Creating Tags in GTM
Tags are code snippets that finally push the data captured by the variables and fired by the triggers to your analytics tool, such as Google Analytics.
- Enabling and Configuring GA4 in VWO
Once you’ve configured GTM, the next step is to enable GA4 integration in VWO.
Creating Data Layer Variables
The first step of VWO<>GA4 integration is to create data layer variables. You must log in to your GTM account and create the following data layer variable with the default value of 0:
Attention: Sections for creating the VWO-UUID data layer variable, VWO-ID-Push-GA4-Trigger, and VWO-ID-Push-GA4-Tag are removed from this article, as they are no longer required for importing GA4 audiences into VWO via GTM. Though retaining these tags will not cause any impact, we recommend removing them to sanitize your account.
VWO-Exp-Variant-String
This data layer variable is used to send the VWO campaign and its corresponding variation values to GA4. The format of this variable value will be "VWO-{campaignId}-{variationId}". To define this variable, perform the following:
- In the Title field, enter VWO-Exp-Variant-String.
- In the Data Layer Variable Name field, enter vwo_exp_variant_string.
- From the Data Layer Version dropdown, choose Version 2.
- Enable the Set Default Value field, and in the Default Value field, enter the value 0 (zero).
- Click Save.
Creating Triggers for the Event
Once you’ve created the data layer variables, the next step is to create the triggers for the events. Triggers are conditions that determine when an event has to be fired to the tag.
To enable VWO to push the campaign data and the UUID of the visitors to GTM, you must create individual triggers for them.
From the GTM dashboard, click Triggers > New and perform the following steps to
create a trigger for the VWO-Exp-Variant-String data layer variable by configuring the following fields:
- In the Trigger Name field, enter VWO-Data-Push-GA4-Trigger.
- Click on the Trigger Configuration tile, and select Custom Event under Other.
- In the Event Name field, enter vwo-data-push-ga4.
NOTE: The event name must always be vwo-data-push-ga4. This event is stored in VWO libraries and pushed when the GA4 integration is enabled for the campaign. - Click Save.
Creating Tags in GTM
Once you’ve created the triggers, the next step is to create the GTM tags. These tags are the code snippets that finally push the data captured by the variables and fired by the triggers to analyze your campaign data inside the analytics tools, such as Google Analytics 4. To complete the process, create the VWO-Data-Push-GA4 tag in the GTM by performing the following steps:
- In the GTM dashboard, click Tags and select New.
- Click on the Tag Configuration tile, and then select Google Analytics: GA4 Event.
- In the Measurement ID field, enter the GA4 ID of the GA4 account to which the data should be sent.
- In the Event Name field, enter experience_impression.
- Expand the Event Parameters section, click on Add Row, and in the Parameter Name field, enter exp_variant_string and in the Value field, enter {{VWO-Exp-Variant-String}}.
NOTE: The event name should always be experience_impression, and the event parameter should always be exp_variant_string. - From the Triggering section, choose the Firing Triggers as VWO-Data-Push-GA4-Trigger.
- Click Save.
Enabling and Configuring GA4 in VWO
Now, GTM is all ready to receive your VWO data. Further, you need to forward the data to GA4 by enabling the GA4 integration option for your VWO campaigns. For details about enabling the VWO<>GA4 integration and further steps of configuration, refer to this article.