Capturing Offer Interactions with ۶Ƶ Web SDK for AI Model Training
This article demonstrates how to capture offer interaction events (like impressions or clicks) using the ۶Ƶ Experience Platform Web SDK by calling alloy(“sendEvent,” …) directly in your JavaScript code. The data is ingested into AEP and used to train AI models in ۶Ƶ Journey Optimizer (AJO) for smarter offer ranking based on real-time behavior.
To create an AI model for offer ranking in ۶Ƶ Journey Optimizer, your dataset must be based on a schema that includes the Proposition Interactions field group. This field group supports key decisioning events like decisioning.propositionDisplay and decisioning.propositionInteract, along with required fields such as involvedPropositions, display, and interact.
There are two valid approaches to achieve this:
- Create a new schema, dataset, and datastream configured specifically for interaction tracking
- Update an existing schema — which is what is done in this tutorial
Update Existing Schema to capture Offer Interaction Events
Instead of creating a new schema, the existing Experience Event schema used for weather-related offers is updated to support interaction tracking.
In ۶Ƶ Experience Platform:
-
Open the existing Weather-Schema Experience Event schema that you are using for weather-based offers.
-
Add the field group:
Experience Event – Proposition Interactions
You do not need to create a new dataset or datastream — continue using your existing setup for weather offers. The events that are sent align with ۶Ƶ Journey Optimizer’s expectations for training AI models and tracking offer performance.
Continue using the current dataset (no need to create a new one)
The existing datastream is already configured and in use in the ۶Ƶ Experience Platform Tags property — no changes are needed there.
The Web SDK automatically routes new interaction events to the correct destination.
This streamlined setup ensures that all decisioning and weather events are ingested into a single, unified dataset, which is ideal for training AI models in ۶Ƶ Journey Optimizer.
Capture Offer Display Events (Impressions)
The HTML structure of the offer was modified to include interactive elements — specifically <a>
and <button>
tags — allowing users to engage with the offer (for example, “Claim Offer” or “Learn More” buttons).
Each button includes a data-offer-id attribute so the corresponding interaction can be properly tracked.
To log when offers are shown to users, the existing JavaScript file used for rendering weather offers was updated to include display event tracking.
A decisioning.propositionDisplay event is now sent using the ۶Ƶ Web SDK (alloy.sendEvent) when one or more offers are displayed. This event includes the required display: 1 flag and references the involved propositions.
alloy("sendEvent", {
xdm: {
_id: generateUUID(),
timestamp: new Date().toISOString(),
eventType: "decisioning.propositionInteract",
identityMap: {
ECID: [{
id: ecidValue,
authenticatedState: "ambiguous",
primary: true
}]
},
_experience: {
decisioning: {
propositionEventType: {
interact: 1
},
propositionAction: {
id: offerId,
tokens: [trackingToken]
},
propositions: window.latestPropositions
}
}
}
});
Capture Offer Click Events (Interactions)
To track when a user clicks on an offer, we updated the existing JavaScript to listen for clicks on both <a>
and <button>
elements rendered inside the offer container.
When a click is detected, a decisioning.propositionInteract event is sent using the ۶Ƶ Web SDK. The event includes the necessary interact: 1 flag and references the specific offer ID and decisioning scope.
// Attach click tracking to <a> and <button> elements
child.querySelectorAll("a, button").forEach(el => {
el.addEventListener("click", () => {
const ecidValue = getECID();
if (!ecidValue || !offerId || !trackingToken) {
console.warn("Girish!!!! Missing ECID, offerId, or trackingToken. Interaction event not sent.");
return;
}
alloy("sendEvent", {
xdm: {
_id: generateUUID(),
timestamp: new Date().toISOString(),
eventType: "decisioning.propositionInteract",
identityMap: {
ECID: [{
id: ecidValue,
authenticatedState: "ambiguous",
primary: true
}]
},
_experience: {
decisioning: {
propositionEventType: {
interact: 1
},
propositionAction: {
id: offerId,
tokens: [trackingToken]
},
propositions: window.latestPropositions
}
}
}
});
});
});
Create an AI Model for Offer Ranking in ۶Ƶ Journey Optimizer Offer Decisioning
With, offer impressions and clicks now captured via the Web SDK and stored in ۶Ƶ Experience Platform, this data can be used to train an AI model that predicts which offers are most likely to drive engagement.
This AI model is referenced in a ranking formula or selection strategy to determine which offers are prioritized for each user.
- Log in to Journey Optimizer
- Navigate to Decisioning -> Strategy setup -> AI models ->Create AI Model
- Make sure to use the correct Dataset
- Save and activate the AI model.
- Update the selection strategy created in the earlier step to use the AI model for the Ranking method
Test the solution
Include the updated JavaScript file in the existing web page