-
Notifications
You must be signed in to change notification settings - Fork 28
Custom Event
If your single page application does not update the URL on view change, consider triggering a custom event instead. An event listener can then be used to trigger mbox calls when this happens. (Note: this technique can be used on small updates to the viewport, too)
Data Layers: Be sure to update your data layer before triggering the event to maximize usage in Target.
DTM: Event-based rules using the "custom" condition can be used to trigger mbox calls. There is an additional roundtrip needed to retrieve code from DTM before making the mbox call.
##Demo:
##Example: Put this code after at.js to trigger mbox calls on custom events:
// Listen for the event broadcast by the framework when it processes a view change
window.addEventListener('NAME_OF_YOUR_CUSTOM_EVENT_THAT_FIRES_AFTER_UPDATING_THE_DATA_LAYER',
function(e) {
adobe.target.getOffer({
mbox: 'target-global-mbox',
params: {
trigger: 'customEvent'
},
success: function(offer) {
adobe.target.applyOffer({
mbox: 'target-global-mbox',
offer: offer
});
},
error: function(status, error) {}
});
}
);These extensions are provided free to developers as a starting point to integrate at.js with their Single Page Application. Extensions are not always updated for the latest at.js version. Customization may be required to integrate successfully with your single page app.
Issues: place send feedback and questions through Github issues. We will respond as best we can. Please note, these extensions are not supported by Adobe Client Care or Target Engineering.