Integrating VWO with Google Tag Manager (GTM) allows you to push your VWO test data to Google Universal Analytics and other analytics tools via GTM.
ATTENTION This integration article is not meant for installing the VWO tracking code through Google Tag Manager, since we don’t recommend integrating VWO through GTM at all.
Create Custom Dimension for VWO Tests
To configure the integration, you must first create a UA custom dimension.
- Sign in to your GA dashboard.
- Click Admin from the menu bar and then select the appropriate account and a property.
- Under Property, click Custom Definitions and then click Custom Dimensions.
- In the page that appears, click New Custom Dimension.
- In the window that appears, enter the following details:
- Name: Enter a unique name for the dimension. Please note that 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. Click here to know more about scope.
- Active: Enable this box to start collecting data and see the dimension in your reports right away.
- Click Create. You have now created custom dimensions in UA.
Create a GTM Variable
- Sign in to your GTM account and select the Container.
- Select Variables and then click New to create a variable.
- Furnish the following variable details:
- 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 Data Layer Version, select Version 1.
- Enable 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.
- Select Triggers and then click New to create a new rule.
- Enter the name for the rule. In our example, it is set as “VWO Rule”.
- Under Trigger Configuration, select Custom Event as the trigger type.
- Put the Event Name as VWO It will always be VWO (do not change this event name).
- For the section This trigger fires on, select Some Custom Events.
- In the next field, select the variable created in the previous step from the drop down and set the condition as ‘does not equal‘.
Create a New Tag in GTM
- Select the Tags option on the side panel and then click New to create a tag for the integration.
- Create tag for the service where you want to push the data from GTM by filling out the information:
- 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. To view more details about the default templates, click this help center article.
For example, if you want to push your Google Universal Analytics data, specify the tag type as Universal Analytics.
- 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.
- Track Type: In this field, select Event to track a specific action or event, such as button click, page visits.
- Under Event Tracking Parameters, enter the following information:
- Category: VWO
- Action: Custom
- Non interaction Hit: True
- Under Custom Dimensions, enter the following details
- 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.
- Dimensions: Enter the macro name here so as to push the data passed to GTM by VWO to UA.
- Click Save to save changes.
- After you have created the tags, you need to associate the tags with firing rules. From Triggering > Firing Triggers section, select the trigger you had created to be associated with the tag.
- Click Save to set the firing rule.
- After completing the configurations, click Publish.
Enabling GTM integration in VWO
Now that you have configured GTM, you just need to enable GTM integration from the VWO Dashboard.
- To enable integration for a new VWO test, you will first create the test and then enable Google Tag Manager option in the last step of the creation process.
- To enable integration for a specific test, select the test and go to the Summary page. Click Settings and select Others option. Then, select Google Tag Manager under Integrate With Third-Party Products.
- To enable GA integration across all tests in your account, click the Settings icon on the upper right of the dashboard. Then select Campaign Settings, and enable Google Analytics in the Integrate With Third-Party Product.