adobe.target.sendNotifications(options)
This function sends a notification to Target edge when an experience is rendered without using adobe.target.applyOffer()
or adobe.target.applyOffers()
.
Request
The following names are not allowed for parameters:
- orderId
- orderTotal
- productPurchasedIds
Consider the following:
- Max 50 parameters limit.
- Parameter name should not be blank.
- Parameter name max length 128.
- Parameter name should not start with “profile.”
- Parameter value length max 5000.
The following names are not allowed for parameters:
- orderId
- orderTotal
- productPurchasedIds
Consider the following:
- Max 50 parameters limit.
- Parameter name should not be blank.
- Parameter name max length 128.
- Parameter name should not start with “profile.”
- Parameter value length max 5000.
Request > notifications > order
id
<=
250 characters.Request > notifications > order
total
>=
0Request > notifications > order
purchasedProductIds
- No blank values allowed.
- Each product Id max length 50.
- Product IDs, separated by commas and concatenated, total length should not exceed 250.
<=
128 characters; cannot be blank.<=
128 characters; cannot be blank.<=
200 characters.<= 128
characters.<int64>
Request > notifications > mbox
name
No blank values allowed.
Allowed chars: See note following this table.
Request > notifications > mbox
state
Request > notifications > view
id
<int64>
Request > notifications > view
name
<= 128
characters.Request > notifications > view
key
<=
512 characters.Request > notifications > view
state
Note: The following characters are not allowed for Request > notifications > mbox > name
:
- '-, ./=`:;&!@#$%^&*()+|?~[]{}'
sendNotifications() call after rendering prefetched mboxes
function createTokens(options) {
return options.map(e => e.eventToken);
}
function createNotification(mbox, type, tokens) {
const id = 11111; // here we should use a random ID like UUID
const timestamp = Date.now();
const { name, state, parameters, profileParameters, order, product } = mbox;
const result = {
id,
type,
timestamp,
parameters,
profileParameters,
order,
product
};
result.mbox = { name, state };
result.tokens = tokens;
return result;
}
adobe.target.getOffers({
request: {
prefetch: {
mboxes: [
{
index: 0,
name: "a1-serverside-ab"
}
]
}
}
})
.then(response => {
const mboxes = response.prefetch.mboxes;
const notifications = mboxes.map(mbox => {
const type = "display";
const tokens = createTokens(mbox.options);
return createNotification(mbox, type, tokens);
});
adobe.target.sendNotifications({
request: { notifications }
});
})
getOffers()
with prefetch only and sendNotifications()
, the Analytics request must be fired after sendNotifications()
is executed. The purpose of this is to ensure that the SDID generated by sendNotifications()
matches the SDID sent to Analytics and Target.