In this article, you’ll learn about the following: |
VWO Event Streamer is a custom tag template that you can import into your GTM account in order to stream custom events from GTM to VWO. This is an effortless approach if you just require fetching custom events from GTM to VWO. You just need to install the VWO streamer as a template on GTM and configure the events to be sent to VWO from GTM.
Let’s say you have created tags in GTM for events such as “Add to Cart”, “Proceed to Checkout”, and “Purchase”, and you use these events in your Google Analytics account. Now, you’re looking to import the same events into VWO to run a campaign for gauging the sellability of a certain product. Don’t worry; you needn’t get into extensive integration here. You can simply install the VWO Event Streamer and add it as a custom template to your GTM account. This streams all your custom events from GTM to VWO just like that.
If you require more capabilities, such as transferring campaign data from VWO to GTM or targeting visitors in your VWO campaigns using a GTM data layer variable, you need to integrate your VWO account with GTM.
Installing VWO Event Streamer on GTM
Perform the following steps to install the VWO Event Streamer on GTM from the template gallery:
- Log in to your GTM account and select the appropriate workspace where you want to install the VWO Event Streamer.
- From the main menu on the left, go to Templates > Tag Templates > Search Gallery
- Search for VWO and then click on VWO Event Streamer
-
Click on Add to workspace
-
Click on Add
Using the VWO Event Streamer Template
Upon successful import, you can use the VWO Event Streamer template to stream the events from GTM to VWO effortlessly. To do that, perform the following steps:
- From the main menu on your GTM dashboard, navigate to Tags > New.
- Name the tag and click on the Tag Configuration section.
-
From the list of tags, under the Custom section, select the VWO Event Streamer tag that you just imported.
-
To customize the tag configuration further, you can utilize the following options:
-
Nested JSON Field Mapping: Allows you to import event properties with JSON nested values into VWO. To do this, click on Add Nested Field Mapping and enter the input in the respective fields as follows:
-
Property Name: The name of the property you want to map.
-
JSON Key Path: The path to the key in the JSON object.
Example JSON Key Paths:
-
For a object such as { "user": { "id": 123, "name": "John Doe" } }, if you want to map the user's name, the JSON key path to use is user.name.
-
For an object containing an array, such as { "items": [ { "id": 1, "name": "Item1" }, { "id": 2, "name": "Item2" } ] }, if you want to map the name of the first item in the array, the JSON Key Path to use is items.0.name.
-
For a object such as { "user": { "id": 123, "name": "John Doe" } }, if you want to map the user's name, the JSON key path to use is user.name.
-
Property Name: The name of the property you want to map.
-
Custom Property: Allows you to add custom properties that will be sent with every event. To add a custom property, click on Add New Property and enter the input in the respective fields as follows:
-
Property Name: The name of the custom property.
-
Property Value: The value of the custom property.
-
Property Name: The name of the custom property.
- If you need to exclude any event or event property from being forwarded to VWO, you can use the Exclude following events and the Exclude following properties settings, respectively.
-
Nested JSON Field Mapping: Allows you to import event properties with JSON nested values into VWO. To do this, click on Add Nested Field Mapping and enter the input in the respective fields as follows:
- Click on the Triggering section, and click on the + icon at the top-right to create a new trigger.
- Name the trigger and click on the Trigger Configuration section.
- We recommend using the following trigger settings to stream all the events to VWO. Configure your trigger settings as follows and click on Save:
-
-
- In the Trigger Type field, select Custom Event.
- In the Event name field, enter “.*”.
- Select the Use regex matching option.
-
Now, your website events from GTM will be streaming into the UNREGISTERED EVENTS section under Events in your VWO Data360 module. You can use these events to set up your campaign triggers, create metrics, and target the visitors for your campaigns.
Supported Event Formats
The VWO Event Streamer only supports events that are directly pushed into the dataLayer or triggered through gtag. Therefore, ensure that your events are structured in one of these formats for them to be successfully imported into VWO:
Pushing Events Directly into dataLayer
dataLayer.push({
"event": "event_name"
});
Triggering Events Through gtag
gtag("event", "event_name");
Configuring Custom Datalayer Variable Name in Google Tag Manager
By default, GTM is set up to access events from your datalayer variable if it's named 'dataLayer.' If you use a different datalayer variable name, follow these steps to specify your dataLayer variable name in GTM. This allows GTM to recognize and stream your events:
- From your GTM dashboard, access Templates > Tag Templates > VWO Event Streamer > Code.
- In the code, replace “dataLayer”, corresponding to const DATALAYER_VARIABLE_NAME, with your custom datalayer variable name and click Save.
- Go to Permissions > Accesses global variables > Add key.
- In the Key field, enter the name of your custom datalayer variable, select Read, and click Add.
Click Save.