Integrating VWO with Google Tag Manager (GTM) enables you to push your VWO test data to Google Universal Analytics and other analytics tools via GTM.
We do not recommend installing the VWO Smartcode through Google Tag Manager, as it might bring in some latency for the VWO Smartcode to work.
For VWO-UA integration, you need to set up the integration for every test you create.
-
Create a Custom Dimension for VWO Tests
Create a Custom Dimension for VWO Tests
The first and the foremost step while integrating VWO with UA is to create a UA custom dimension.
Procedure
-
Login to your GA account.
- From the GA dashboard, go to the ADMIN tab and select the appropriate account and property.
-
From the Property section, select Custom Definitions > Custom Dimensions.
-
To create a custom dimension, click +New Custom Dimension on the Custom Dimensions page.
-
Configure the following fields for your custom dimension.
- Name: Enter a unique name for the dimension.
NOTE: You must create a separate dimension for each running test you want to integrate with UA. The dimension you create is used to identify and push VWO data into the corresponding dimension in UA. For example, VWO Test Id 1. -
Scope: Select the User option from the list. Scope determines which hits will be associated with the custom dimension value. To know more about the scope, refer to the Session-level scope.
-
Active: Enable this box to start collecting data and see the dimension in your reports right away.
-
Once done, click Create to finalize your changes.
You have now created custom dimensions in UA.
Create a GTM Variable
Once you have created a custom dimension, the next step is to create a GTM variable.
Procedure
-
Login to your GTM account.
-
From the GTM dashboard, select the Container you want to work with.
-
From the panel on the left, select Variables and click NEW to create a variable.
-
Configure the following fields for your variable.
-
Enter a name for the variable (usually corresponds to the dimension name you created for your UA integration).
-
Under Page Variables, select Data Layer Variable as the variable type.
-
In the Data Layer Variable Name field, enter Campaign-ID (replace ID with your VWO Test ID). For example, Campaign-1234. This value is case sensitive.
-
In the Data Layer Version, select Version 1.
-
Enable the Set Default Value option and set the value to 0.
-
Click Save to create the variable.
Set Firing Rules for the Event
Create an event rule that will enable VWO to push test data to GTM. Creating a rule fires the tag you defined.
Procedure
-
Login to your GTM account.
-
From the GTM dashboard, select the Container you want to work with.
-
From the panel on the left, select Triggers and click NEW to create a rule.
-
Enter the name for the rule.
-
Under Trigger Configuration, select Custom Event as the trigger type.
-
Set the Event Name as VWO. (do not change this event name).
-
Set the This trigger fires on field to Some Custom Events.
-
In the next field, select the variable created in the previous step and set the condition as does not equal 0 (zero).
Create a New Tag in GTM
-
Login to your GTM account.
-
From the GTM dashboard, select the Container you want to work with.
-
From the panel on the left, select Tags and click NEW to create a tag for the integration.
-
Create a tag for the service where you want to push the data from GTM by configuring the following fields.
-
Name: Enter a name for the tag you want to create. For example, GA is the name of the tag in our example.
-
Tag Type: In this field, specify the service to which you want to push the test data using GTM. Google provides a few default templates, but you can also use your custom tags. For example, if you want to push your Google Universal Analytics data, specify the tag type as Universal Analytics. To know more about the default templates, refer to Google Tags.
-
Track Type: In this field, select Event to track a specific action or event, such as button clicks, page visits.
-
In the Event Tracking Parameters section, configure the following fields.
-
Category: VWO
-
Action: Custom
-
Non-interaction Hit: True
-
Select Enable overriding settings in this tag option
-
Tracking ID: In this field, enter the tracking ID of the data you want to push. For example, in our case, the UA tracking ID could be UA-1234567-1.
-
In the Custom Dimensions section, configure the following fields.
- Index: Select an index number (1-20) to associate with the Custom Dimension you specified. This is based on the custom dimension you have created inside your UA account to collect VWO data.
NOTE: For each running test, we recommend using a different custom dimension index. If a single custom dimension is used, the last test information that the user became a part of will overwrite the information pushed previously. -
Dimensions: Enter the macro name here to push the data passed to GTM by VWO to UA.
-
Click Save to finalize changes.
-
After you have created the tags, you need to associate the tags with firing rules. To do this, go to the Triggering > Firing Triggers section and select the trigger you have created to associate with the tag.
-
Click Save to set the firing rule.
-
Once you are done with the configurations, click Publish.
Enabling GTM integration in VWO
Now that you have configured GTM, you need to enable GTM integration from the VWO Dashboard.
Procedure
- Login to your VWO account
- Go to TESTING and select a testing type, say A/B.
- On the OTHERS page of the test creation, expand the Integrate with third-party products, and select the options Google Tag Manager.
NOTE: The Google Tag Manager option appears only after you have enabled it in the INTEGRATIONS section.
- If you want to enable the integration for a specific test, select the test and from Summary, go to. Click SETTINGS > OTHERS and select Google Tag Manager from the Integrate With Third-Party Products section.