Reference

iAdvize.help

  • Lists all the available methods,

  • Lists all the available properties on get and set,

  • Lists all the available events on on and off.

iAdvize.activate / iAdvize.logout

These methods are used for authentication. Please see the dedicated Help Center article : https://help.iadvize.com/hc/articles/6043078724626

iAdvize.get

iAdvize.get takes a single property argument, and returns the associated value. Properties are keys that reference values that can change over time. These values can be accessed :

  • directly, using iAdvize.get (ex: iAdvize.get('visitor:cookiesConsent'))

  • when they change, using iAdvize.on (ex: iAdvize.on('visitor:cookiesConsentChange', callback))

Example :

window.iAdvizeInterface = window.iAdvizeInterface || [];
window.iAdvizeInterface.push(function (iAdvize) {
  const visitorCookiesConsent = iAdvize.get('visitor:cookiesConsent');
});

iAdvize.set

Set editable properties.

Example :

window.iAdvizeInterface = window.iAdvizeInterface || [];
window.iAdvizeInterface.push(function (iAdvize) {
  iAdvize.set('visitor:GDPRConsent', true);
});

iAdvize.on / iAdvize.off

Listen to a property change.

iAdvize.on takes two arguments :

  • The name of an event,

  • A callback that takes the associated event value as parameter.

Every property available on iAdvize.get also has a corresponding event (iAdvize.on('{property}Change', (value) => {...})).

iAdvize.off takes the same arguments to remove the event listener.

Example :

window.iAdvizeInterface = window.iAdvizeInterface || [];
window.iAdvizeInterface.push(function (iAdvize) {
  iAdvize.on('visitor:cookiesConsentChange', function (visitorCookiesConsent) {
    console.log(visitorCookiesConsent);
  });
});

Listenable events

Some specific events can be listened with the on method :

iAdvize.recordTransaction

Allows to record transactions. See the dedicated article on the Help Center: https://help.iadvize.com/hc/en-gb/articles/206375538

Example :

window.iAdvizeInterface = window.iAdvizeInterface || [];
window.iAdvizeInterface.push(function (iAdvize) {
  iAdvize.recordTransaction({
    id: 'unique-id',
    amount: 49.95,
  });
});

iAdvize.navigate

If part of your web site is built using SPA technology that does not update your browser's history (=your site's url does not change, even though the page displayed to the visitor does), you can simulate a page change using the iAdvize.navigate("YOUR_PATH") method.

This will restart iAdvize's targeting engine to take into account the new URL/path value you enter as parameter.

Last updated