Integrating Webtrends Optimize with Google Analytics via. GTM
There are a couple of ways to send your experiment views into Google Analytics. This considers how to acheive this via. Google Tag Manager (GTM).
Step 1: Enable the integration in Manage Integrations
To get started, launch the top nav, and find Manage > Integrations.

Next, use the button in the top-right corner to start a New Integration

Then, find Google Analytics (via. GTM) and click Install Integration


If you would like to change any settings, now is the right time to. Once ready:
- Flip the toggle switch
- Pick the tags you'd like this to apply to (ALL is fine, if you don't need to QA-test this change)
- Hit Save

Assuming there's nothing else you'd like to configure, your integration is now live for all users and so you can stop here.
Step 2: Customise how the data is sent to the Data Layer
For greater freedom, we suggest swapping our hard references to Event Category, Event Action and Event Label to variable references instead. Once you do, you're able to set things up however you wish in GTM, which most users are more familiar with.
When in the Edit Integration screen, click CODE

Replace the code with this:
window.dataLayer = window.dataLayer || [];
dataLayer.push({
'event': `{{event}}`,
'WT_project': projectAlias,
'WT_test': testName,
'WT_variation': experimentName
});
Step 3: Setting up the events in Google Tag Manager
The next step is to allow Google Tag Manager to react to these events and variables being triggered.
Start by logging into https://tagmanager.google.com/
Set up your variables
First, go to Variables > User Defined Variables > New

Create a new Data Layer variable, called WT_project

Enter a variable name of WT_project

Repeat these steps to create variables of WT_test and WT_variation
Set up a trigger
Start creating a new trigger:

Select Custom Event, and specify the name provided in the Optimize UI - by default, Optimize-View

Save the trigger.
Set up a tag
Start creating a new tag:

Starting backwards with triggering - pick the trigger you've just made

For Tag Configuration, pick Google Universal Analytics
For the other settings:
- Track type: Event
- Category, Action, Label - Whatever you'd like. To reference the variables, use double curly braces, e.g. {{WT_project}}
- Non-interaction Hit: true - This is important to make sure entry to tests don't disturb your bounce rate.

Step 4: Validating data collection
There are a few things you can do to validate data is being sent or collected.
- Once you fall into a test, open the Console in Developer Tools and type in
window.dataLayer
. Search through the entries that show up, and see if you spot an event matching the tag that you built. - Check network requests. Filter by the word "collect" (no quotation marks) and inspect calls going out to Google Analytics. Make sure you can see our data in one of those calls - typically one of the last ones you see in the list.
- Check your reports in Google Analytics. Realtime events are a decent place to look first - it'll typically take a little while to roll-up into other reports.