JavaScript hooks

Developers can hook into RightMessage’s JavaScript API to do more advanced things, like sending conversion/segmentation data to apps that RightMessage doesn’t natively integrate with.

Want to do something that isn’t listed here? Let us know.

JavaScript events

We trigger events on the document when various things happen. You can listen to these events to trigger whatever functionality you need. Current events:

Visitor answers a question in a RightMessage widget

// rm:widget:answer
//
// Properties:
// - widgetId       e.g. "wdg_1234abcd"
// - widgetName     e.g. "Blog sticky bar"
// - dimensionId    e.g. "dim_1234abcd"
// - dimensionName  e.g. "Job role"
// - questionText   e.g. "You said you work for a retail firm - what's your role there?"
// - segmentId      e.g. "seg_1234abcd"
// - segmentName    e.g. "Sales director"
//
// Example implementation:

document.addEventListener("rm:widget:answer", function(event) {
  console.log("Visitor's " + event.detail.dimensionName + " is " + event.detail.segmentName);
});

Visitor accepts an offer in a RightMessage widget

// rm:widget:acceptOffer
//
// Properties:
// - widgetId       e.g. "wdg_1234abcd"
// - widgetName     e.g. "Blog sticky bar"
// - offerId        e.g. "ofr_1234abcd"
// - offerName      e.g. "Newsletter opt-in"
// - emailAddress   e.g. "sam@example.com"
//
// Example implementation:

document.addEventListener("rm:widget:acceptOffer", function(event) {
  console.log(event.detail.emailAddress + " just opted in for " + event.detail.offerName);
});
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us