my image Some great alternative text

Integration

GTM events

Forward Unless experience events to your GTM account.

my image Some great alternative text

Context

You can measure the success of your experiences using the Unless Insights while keeping an eye on the goals you've set and the audiences you are building.

However, if you want to dig deeper or simply prefer using other tools like Google Analytics or Mixpanel as your single source of truth, this integration is for you.

How does it work?

With this integration, we'll send event data about shown experiences to your GTM account. From GTM you can forward these events to your favorite tools like Google Analytics and Mixpanel.

Install instructions

Simply toggle the switch to activate it and we'll start sending data to the GTM account associated with your website - no need for additional setup.

Once the integration is activated we will automatically start sending events to GTM through the data-layer. The event is structured as follows:

We'll send one event for each experience applied to the page:

{
    'event': 'Unless', //fixed value
    'event_params': {
        'event_type': 'third_party', //fixed value
        'experience_name': 'My first component', //name of your experience
        'experience_id': 'b81d0e43-3814-4f52-affe-8859cf2419d2', //experience id
        'experience_type': 'Component', //'Component' or 'On-site'
        'experience_test': 'Participant' //'Control' or 'Participant' or the variant name
    }
}
Additional instructions:
  1. To use any of the fields from the object above, you have to create variables in your GTM setup. Create a variable in GTM and choose ‘data layer variable’. As the data layer variable name you set one of the fields from the datalayer event, for example "event_params.experience_name" and for the Variable name (on top) you can use something like "Unless experience name". Do the same for any field you'd like to use.
  2. Secondly, create a trigger. When creating a new trigger, choose ‘custom event’ and set the event name to "Unless". Call the trigger something like "Unless trigger".
  3. Finally, you can create the tag. In the tag, choose the trigger you created earlier. Then, choose "custom HTML" as the tag type. To test if it works you can use the follow code as the value:
<script>
  console.log('unless experience event triggered', 
              {{Unless experience name}})
</script>

Note, this will simply print the values to the browser's development console. Instead of this, you’d want to send them to a different tool like Mixpanel or Google Analytics.

Related content

Frequently asked questions

Simply toggle the switch to activate the Google Analytics integration and we'll start sending data to the Google Analytics account associated with your website - no need for additional setup.

my image Some great alternative text

Friendly support from real people

We’re here to help

We are known for our quick responses if you have an issue. Feel free to ask us anything. But you can also ask our conversational AI a question, of course!