Skip to content

Instantly share code, notes, and snippets.

@joemidi
Last active March 18, 2024 11:25
Show Gist options
  • Save joemidi/0d643a0b7e4c03983b974ac940fc568d to your computer and use it in GitHub Desktop.
Save joemidi/0d643a0b7e4c03983b974ac940fc568d to your computer and use it in GitHub Desktop.
Enabler exits
var queryString = 'q=headphones';
banner.addEventListener('click', function () {
Enabler.exitQueryString('clickthrough', queryString);
});
// You can use the Enabler.exitQueryString() method to apply an query string to an exit URL.
// Note that the base URL will still come from within the Studio interface.
// Alternatively you can create the full URL yourself using Enabler.exitOverride()
var params = {
parameter1: 'value_1',
parameter2: 'value 2',
parameter3: 'value&3'
};
// Encode your parameters so that they are URI safe
var esc = encodeURIComponent;
var queryString = Object.keys(params)
.map(function(k) {return encodeURIComponent(k) + '=' + encodeURIComponent(params[k]);})
.join('&');
// Build up the exit URL
var exitURL = 'https://myexit.url/'
var exitURLAndQuery = exitURL + '?' + queryString;
// Create click event for the Exit
banner.addEventListener('click', function () {
Enabler.exitOverride('clickthrough', exitURLAndQuery);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment