ATTENTION: This method for the integration has been deprecated. For the new method, follow the steps mentioned in this article. It provides you with added flexibility to set up VWO variations as audiences in GA4 and import GA4 audiences into VWO to target visitors in VWO.
Google Analytics 4 (GA4) is the latest version of Google Analytics. It’s called GA4 as it’s the fourth version of Google Analytics, which is quite different from the traditional “universal” Analytics. GA4 is all about events, i.e., events are essential to present data in the new Google Analytics.
One of the advantages of the GA4 property is that you can use it for a website, an app, or a website and app together. Universal Analytics properties only support websites. To know more about GA4, refer to Meet the next generation of Google Analytics.
VWO supports integration with GA4 and by setting up this integration, you can push VWO campaign data into GA and analyze it further.
Integrating VWO with GA4
Integrating VWO with Google Tag Manager (GTM) enables you to push your VWO campaign data to Google Universal Analytics (GA4).
Setting-up the VWO<>GA integration is a four-step process:
- Create Data Layer Variable
These variables are used to create tags and define triggers for events to execute. - Create Firing Rules
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. - Create GTM Tags
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. - Enable GTM in VWO
Once you’ve configured GTM, the next step is to enable GTM integration from the VWO Dashboard.
Prerequisite
Before you start setting up the VWO<>GA integration, you must create a single custom dimension in GA4. This is done to allow VWO to use the custom dimension to tag the following A/B test information in GA4- A/B test ID, A/B test Name, Variation ID, and Variation Name.
To create a custom dimension in GA4, follow this:
Procedure
- Login to your GA4 account.
- From the left panel, go to click CONFIGURE > Custom definitions.
- To create a custom dimension, click Create custom dimensions.
- In the Dimension name field, specify the value as VWO_AB_Test.
- From the Scope dropdown, select Event.
- In the Description field, enter a description for your custom dimension.
- In the Event Parameter field, enter the value as VWO_AB_Test.
- To finalize your custom dimension, click Save.
Create Data Layer Variable
The first step of VWO<>GA integration is to create data layer variables. You must log in to your GTM account and create the following four data layer variables with the default value of 0.
- CampaignId
For the campaignId field, configure the following:
-
-
- In the Title field, enter CampaignId.
- In the Data Layer Variable Name field, enter CampaignId.
- From the Data Layer Version dropdown, choose Version 1.
- Enable the Set Default Value field and in the Default Value field, enter the value 0 (zero).
-
- CampaignName
For the CampaignName field, configure the following:
-
- In the Title field, enter CampaignName.
- In the Data Layer Variable Name field, enter CampaignName.
- From the Data Layer Version dropdown, choose Version 1.
- Enable the Set Default Value field and in the Default Value field, enter the value 0 (zero).
- VariationId
For the VariationId field, configure the following:
-
- In the Title field, enter VariationId.
- In the Data Layer Variable Name field, enter VariationId.
- From the Data Layer Version dropdown, choose Version 1.
- Enable the Set Default Value field and in the Default Value field, enter the value 0 (zero).
- VariationName
For the VariationName field, configure the following:
-
-
- In the Title field, enter VariationName.
- In the Data Layer Variable Name field, enter VariationName.
- From the Data Layer Version dropdown, choose Version 1.
- Enable the Set Default Value field and in the Default Value field, enter the value 0 (zero).
-
Create Firing Rules for the Event
Once you’ve created the Data Layer variables, the next step is to create the Firing Rules. Also known as Triggers, firing rules are conditions that evaluate to either fire or not fire an event to the tags.
To enable VWO to push campaign data to GTM, you must create the following two event rules:
VWO-Generic
Create a firing rule for the Campaign ID data variable by configuring the following fields:
- In the Trigger Name field, enter VWO-Generic.
- From the Trigger type field, select Custom Event.
NOTE: Click the Custom Event textbox and wait for the options to appear. Now select the one you want. - In the Event Name field, enter VWO.
NOTE: The event name must always be VWO. This event is stored in VWO libraries and pushed when the GTM integration is enabled for the test. - For the This trigger fires on field, select Some Custom Events.
- For the Fire this trigger when an Event occurs and all these conditions are true field, specify the CampaignId variable created already, and the condition as equals to 0(zero).
VWO-Data-Push
Create another firing rule for the CampaignId and VariationId data variables by configuring the following fields:
- In the Trigger Name field, enter VWO-Data-Push.
- From the Trigger type field, select Custom Event.
NOTE: Click the Custom Event textbox and wait for the options to appear. Now select the one you want. - In the Event Name field, enter VWO-data-push.
NOTE: The event name must be VWO-data-push always and is case sensitive. - For the This trigger fires on field, select Some Custom Events.
- For the Fire this trigger when an Event occurs and all these conditions are true field, specify the CampaignId and VariationId variables, and then set the condition as does not equal to 0 (zero).
Create GTM Tags
Once you’ve created the Firing Rules, 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 A/B test data inside the analytics tools, such as Google Analytics. To complete the process in the GTM dashboard, create the following two tags:
VWO<>GTM Integration
To learn how to create VWO<>GTM tag, follow this:
Procedure
- In the GTM dashboard, click Tags and select New.
- Edit Tag Configuration, and then select the Custom HTML tag option.
- In the HTML field, enter the following custom code:
NOTE: If you're using any variable other than "dataLayer", you need to replace the instances of "dataLayer" correspondingly.
- From the Triggering section, choose the Firing Triggers as VWO-Generic.
VWO-GA4-Integration
To learn how to create VWO<>GA4 tag, follow this:
Procedure
- In the GTM dashboard, click Tags and select New.
- Edit Tag Configuration, and then select the Google Analytics GA4 Event tag option.
- In the Configuration Tag field, select Manually Set ID.
- In the Measurement ID field, enter the GA4 ID where the data should be sent.
- In the Event Parameters field, enter the Parameter Name as VWO_AB_Test and Value as {{CampaignId}}_{{CampaignName}}:{{VariationId}}_{{VariationName}}.
NOTE: The length of the event parameter value, as supported by Google, should not exceed 100 characters. - From the Triggering section, choose the Firing Triggers as VWO-Data-Push.
NOTE: This is a one-time integration to push all your test data by using GTM tags. You must also enable the GTM Integration option for the tests.
Enable GTM Integration in VWO
Once you’ve configured GTM, the last step is to enable GTM in your VWO account.
Procedure
To enable GTM in your VWO account, follow this:
-
Login to your VWO account.
- Enable the Google Tag Manager integration from the INTEGRATIONS section.
- Go to TESTING and select a testing type, say A/B.
-
Create a test and on the OTHERS page of the test creation, expand the Integrate with third-party products, and select the option Google Tag Manager.
-
If you want to enable the integration for an already created test, select the test and go to Summary.
-
Click SETTINGS > OTHERS and select Google Tag Manager from the Integrate With Third-Party Products section.
Configuring the VWO<>GA Integration Through File Upload
To set up the VWO<>GA4 integration through a file upload, follow this:
Procedure
- Download the GTM JSON file here[right click on the link and select Save Link As].
- Login to the GTM and Navigate to Admin.
- Click on Import Container.
- Next, upload the JSON file downloaded in the first step and follow the steps mentioned in the screenshot.
- Click Confirm.
After successful import, go to Tags > VWO-GA4-Integration and change the Measurement ID to the one from your Analytics Account.
- Publish the changes, and you are all set.
Viewing the A/B Test Data in GA
Once the data is pushed, you can start looking into the A/B test data in conjunction with the vast range of metrics GA offers and analyze the variation that had the maximum impact on the end conversion rate.
VWO sends A/B tests data in the custom dimension VWO_AB_Test, and this custom dimension can be used anywhere inside GA4 to slice and dice the data further.
In this example, our A/B test has the following configuration, and our objective is to see how the A/B test variations performed against each other:
To view your Analytics account data and compare the variations of an A/B test against each other, follow this:
Procedure
- Log in to your Analytics account.
- Go to the reports section that you want to analyze(Let’s say Acquisition).
- Click on Add Comparison.
A dialog appears on the right. - In the dialog, search for the VWO_AB_Test dimension and select it.
- In the Dimension values, the pushed data is populated automatically.
- VWO sends the data in this format: TestID_TestName:VariationID_VariationName.
- To pull the control group’s data, select the respective value from the dropdown and click Apply.
- Repeat the same process for the rest of the variations of the A/B test.
- Eventually, this is how the comparison looks:
Once you have the users break-down by the different variations, you can expand this to compare all the GA metrics, for example, bounce rate/average engagement time or even the conversions/revenue.
This will allow you to find out which variation worked the best when an A/B test was running.