Olytics Integration

To setup Olytics in your Google Tag Manager account, we'll need to create a tag and a few variables.

Create a Custom HTML Tag

This tag will hold our script provided from Olytics. We've called this tag "Olytics Tracker", but feel free to name this whatever you want. Set the Triggering to fire on the DOM Ready event, and to fire once per page. The HTML coming from Olytics will look something like this:

Create variables to hold Olytic values

You'll notice a couple of values surrounded with double brackets; Olytics Key, Olytics Brand Env ID, Olytics Category, and Olytics Tag. These are GTM variables, and will be passed to Olytics when your page is rendered.

The Olytics Topic and Olytics Category variables will be of the type Custom Javascript. This Javascript will retrieve the keywords or topics from the Data Layer when a page loads, and pass it to Olytics. It takes an array and joins them together, separated by a comma and a space.

// Olytics Topic Variable function() { var newTopics = window.dataLayer[0].keywords; return !newTopics.length ? newTopics : newTopics.join(', '); }
// Olytics Category Variable function() { var newTopics = window.dataLayer[0].topics; return !newTopics.length ? newTopics : newTopics.join(', '); }

Olytics Key, Olytics Brand Env ID, and Olytics Tag will be of the type Constant. The value for each of these are provided in your original Olytics Javascript. Setting these up as a variable is not required, you could alternatively leave them directly in your Olytics GTM Tag.

All done! Once you preview or publish your changes in GTM you'll see the Olytics compiled Javascript in your HTML source.