Expand my Community achievements bar.

Custom Events - Expose detail payload passed to custom event


Level 9


Go to Rules. Under EVENTS, click the + icon to add a new condition.

In the Event Configuration, choose:

Extension: Core

Event Type: Custom Event

This is for triggering a rule based off a custom event listener to be dispatched elsewhere.  Exact syntax depends on details, but assume

Custom Event Type: someEvent

Elements matching the CSS selector value: document

The rendered js is basically this:

document.addEventListener("someEvent", function(evt) {

    /* other stuff from rule placed here */


Custom Events have ability to have data payloads passed to the receiving callback function when they are dispatched.  Here is a generic example:

CustomEvent - Web APIs | MDN

// add event listener for custom event "someEvent"

document.addEventListener("someEvent", function(evt) {

    console.log(evt.detail); // output: {'foo':'bar'}


// payload of data to pass to custom event

var data = {

  'foo' : 'bar'


// create and dispatch custom event, including the payload

var ev = new CustomEvent('someEvent',{detail:data});


Unless I somehow missed something, Launch currently does not expose the data payload to the rule (evt.detail in the example above). 

I would like to see this exposed to the rule.

1) This can be added as part of the Event Configuration itself, where you specify other things, such as the event type (name), css selector, etc. It can be used to offer more granular level of qualifying the condition for triggering the rule based on some property value in the payload.

2) Similar (or alternative to) point #1, conditions(s) and/or exceptions based on payload data can be added

3) Actions can be added that can utilize the data passed to the custom event, for example, setting an Adobe Analytics variable.

For Launch fields, this can be referenced with syntax similar to clicked link syntax (e.g. %this.href% for the link href attribute).  But for example, could do %evt.details.foo% or cut out the passed arg namespace for just %details.foo% or whatever.

For custom code boxes, maybe it can be pushed to the event object, similar to how you do event.$rule (e.g. event.$rule.name) today. Maybe event.$details object or whatever.

Well, regardless of how you want to present it in the interface, I imagine it should be relatively easy to implement, since the core / underlying javascript functionality for this already exists.




Level 9


Okay, disregard this. Apparently this is already a thing, and I typo'd something while testing.

You can in fact use (e.g. based on above example) %event.detail.foo% syntax in the fields, or event.detail.foo in custom code boxes.