Custom JS triggers allow you to write your own code to handle segment matching.
In a nutshell, our services are continually modelling user behaviours throughout their journey as inferences, and data is surfaced frequently to inform a user's current phase in relation to their Intent. This drives segmentation and you can piggy back onto inferences in realtime.
Event capturing using triggers
Create the trigger
Copy and paste the execution code shown to you in the trigger modal. It looks like this:
document.addEventListener(
'intent.campaign.<trigger ID>',
function(e) {
// Run campaign code here
}
);Save the trigger
When the segment matches subject to the method and trigger conditions given to it, the 'intent.campaign.<trigger ID>' event is dispatched and the callback function invoked
This event is dispatched every time that this experience is triggered. Note: you should register this event listener before the Intent client script is loaded and page view events are dispatched.