Edit in GitHubLog an issue

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().

KeyTypeRequired?Description
consumerIdStringNoDefault value is client's global mbox if not provided. This key is used to generate the supplemental data ID used for A4T integration.
RequestObjectYesSee Requests table below.
timeoutNumberNoRequest timeout. If not specified the default at.js timeout is used.

Request#

Field NameTypeRequired?LimitationDescription
Request > notificationsArray of ObjectsYesNotifications for the displayed content, clicked selectors, and/or visited views or mboxes.
Request > notifications > addressObjectNo
Request > notifications > address > urlStringNoURL from which the notification was fired.
Request > notifications > address > referringUrlStringNoThe referral URL from which the notification was fired.
Request > notifications > parametersStringNoThe 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 > profileParametersStringNoThe 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 > orderObjectNoObject that describes the order details.
Request > notifications > order > idStringNo<= 250 characters.Order ID.
Request > notifications > order > totalStringNo>= 0Order Total.
Request > notifications > order > purchasedProductIdsArray of StringNo
  • No blank values allowed.
  • Each product Id max length 50.
  • Product IDs, separated by commas and concatenated, total length should not exceed 250.
Order Product IDs.
Request > notifications > productObjectNo
Request > notifications > product > idStringNo<= 128 characters; cannot be blank.Product ID.
Request > notifications > product > categoryIdStringNo<= 128 characters; cannot be blank.Category ID.
Request > notifications > idStringYes<= 200 characters.Notification ID will be returned in response and will indicate that the notification was processed successfully.
Request > notifications > impressionIdStringNo<= 128 characters.Impression ID is used to stitch (link) the current notification with a previous notification or execute request. In case both of them match, the second and other subsequent requests will not generate a new impression to the activity or experience.
Request > notifications > typeStringYes“click” or “display” is supported.Notification type.
Request > notifications > timestampNumber<int64>YesTimestamp of the notification in milliseconds elapsed since UNIX epoch.
Request > notifications > tokensArray of StringYesA list of tokens for displayed content or clicked selectors, based on the type of notification.
Request > notifications > mboxObjectNoNotifications for the mbox.
Request > notifications > mbox > nameStringNoNo blank values allowed.
Allowed chars: See note following this table.
mbox name.
Request > notifications > mbox > stateStringNombox state token.
Request > notifications > viewObjectNo
Request > notifications > view > idInteger <int64>NoView id. The id that was assigned to the view when the view was created via the view API.
Request > notifications > view > nameStringNo<= 128 characters.Name of view.
Request > notifications > view > keyStringNo<= 512 characters.View key. The key that was set with the view via the API.
Request > notifications > view > stateStringNoView state token.

Note: The following characters are not allowed for Request > notifications > mbox > name:

Copied to your clipboard
- '-, ./=`:;&!@#$%^&*()+|?~[]{}'

sendNotifications() call after rendering prefetched mboxes#

Copied to your clipboard
1function createTokens(options) {
2 return options.map(e => e.eventToken);
3}
4
5function createNotification(mbox, type, tokens) {
6 const id = 11111; // here we should use a random ID like UUID
7 const timestamp = Date.now();
8 const { name, state, parameters, profileParameters, order, product } = mbox;
9 const result = {
10 id,
11 type,
12 timestamp,
13 parameters,
14 profileParameters,
15 order,
16 product
17 };
18
19 result.mbox = { name, state };
20 result.tokens = tokens;
21
22 return result;
23}
24
25adobe.target.getOffers({
26 request: {
27 prefetch: {
28 mboxes: [
29 {
30 index: 0,
31 name: "a1-serverside-ab"
32 }
33 ]
34 }
35 }
36})
37.then(response => {
38 const mboxes = response.prefetch.mboxes;
39 const notifications = mboxes.map(mbox => {
40 const type = "display";
41 const tokens = createTokens(mbox.options);
42
43 return createNotification(mbox, type, tokens);
44 });
45
46 adobe.target.sendNotifications({
47 request: { notifications }
48 });
49})
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.