Documentation
NAV Navbar
  • Events available from the Activation API
  • Events available from the Activation API

    Context

    In addition to the usual methods and data structures provided by Kameleoon's Activation API, some custom DOM events are also fired by our JavaScript engine. They make excellent entry points to customize's Kameleoon behavior and extend our platform. For instance, you can listen to the Kameleoon::ExperimentTriggered event to be notified in your own JavaScript code whenever a new experiment is triggered.

    A full list of currently implemented events is provided below. If you think an useful event is absent from our current Activation API, do not hesitate to contact our teams to ask for an improvement. It's easy for our developers to add new events which can suit your needs.

    List of events

    Kameleoon::Load

    window.addEventListener("Kameleoon::Load", function (event) {
        var loadTime = event.detail.loadTime;
        var timeout = event.detail.timeout;
    });
    

    This event is fired when the Kameleoon application file has finished loading and is available for execution in the browser. The event is fired at the initialization of Kameleoon's engine, not when the engine has completed setup and initial execution.

    Data available in the event
    NameTypeDescription
    loadTimeNumberTime of the completed loading of the Kameleoon application file (UTC format - ms since 1st January, 1970).
    timeoutBooleantrue if a timeout occured during the (asynchronous) load of the Kameleoon application file.

    Kameleoon::ExperimentTriggered

    window.addEventListener("Kameleoon::ExperimentTriggered", function (event) {
        var experiment = event.detail.experiment;
        var experimentId = experiment.id;
        var associatedVariationId = experiment.associatedVariation.id;
    });
    

    This event is fired whenever a new experiment is triggered (ie, when the visitor matches the target segment of the experiment). Note that the event will be fired several times during the session, if the experiment triggers on several pages, not just the first time.

    Data available in the event
    NameTypeDescription
    experimentObjectExperiment object.

    Kameleoon::PersonalizationTriggered

    window.addEventListener("Kameleoon::PersonalizationTriggered", function (event) {
        var personalization = event.detail.personalization;
        var personalizationId = personalization.id;
    });
    

    This event is fired whenever a new personalization is triggered (ie, when the visitor matches the target segment of the personalization). Since some exposition options may be associated with the personalization, such as capping, it can happen that the actual personalization action does not take place (banner or popin not displayed, for instance). Also note that the event will be fired several times during the session, if the personalization triggers on several pages, not just the first time.

    Data available in the event
    NameTypeDescription
    personalizationObjectPersonalization object.