Skip to main content
All CollectionsIntegrations
How to set up a new integration
How to set up a new integration

Learn how to set up an integration using GTM

Charley Bader avatar
Written by Charley Bader
Updated over a week ago

We’re working on expanding our Integration Library within the platform. If there is an integration you’d like to see, please let us know here

However, in the meantime, you are able to set up your own integration to push intent specific events to your tool of choice

To do this, follow the guidance below to set-up an integration.

dataLayer Integrations

When the MWI snippet is installed on your site, you have the option to define an events based dataLayer, in order to push intent specific events.

There are two events that the MWI script will push to the dataLayer:

  • intent.gtm.inference - this dataLayer event will be pushed for each page_view and click event, and will pass through to the dataLayer, the latest inference data from that event

  • intent.gtm.has-changed - this dataLayer event will be pushed only when there has been a change in predefined intent variables, that you’d like to listen for. Speak to your customer success team in order to update this. Currently, you can choose to listen for changes against; buying_stages, Expected Conversion (xc), Expected Progression (xp), Expected Exit (xe), Expected Add to Cart (xatc), Expected Return (xr) and momentum.

You can set up a Custom Event in Google Tag Manager (GTM) to listen out for these events. The events will display when the inference data is available:

You can use the following configuration, to trigger Tags when this data is available:

You can access all information passed to the dataLayer, using the below set up (but changing the reference, to the specific variable):

The dataLayer information passed with each event, is as follows:

Front-End Data Integration

In order to view the data that is available; use the following code snippet in your browser console:

window.intent.inference.listen((data) => {
console.log(data);
});

When attached to the window, this snippet will return the data available from MWI. This data is returned with every inference the model makes. Inferences are returned on page view, click and after set timed intervals.

You can see an example of the full object below.

The variables available in the object can then be accessed in the returned data e.g. in order to pass the intent label, you would use:

data.intent.xc.latest_label

An example of a full integration; could look something like so:

window.intent.inference.listen((data) => {
thirdPartyTool.track("event_name", {
'current_intent_label': data.intent.xc.latest_label,
'max_intent_label': data.intent.xc.max_label,
'current_intent_score': data.intent.xc.label,
//additional variables...
});
});

In the returned data object, there is a property called has_changed that will only populate with information when there has been a change in the variables you identify.

For example, if you’re looking to pass customer level information e.g. intent levels, rather than sending this with every inference, you may want to check for updates in the has_changed property and use this to update customer profiles.

Did this answer your question?