Send parameters to Target using Platform Web SDK
Target implementations differ across websites due to site architecture, business requirements, and features used. Most Target implementations include passing various parameters for contextual information, audiences, and content recommendations.
Let鈥檚 use a simple product details page and an order confirmation page to demonstrate the differences between the libraries when passing parameters to Target.
Assume the following two example pages using at.js:
| code language-html |
|---|
|
| code language-html |
|---|
|
Parameter-mapping summary
The Target parameters for these pages are sent differently using the Platform Web SDK. There are multiple ways to pass parameters to Target using at.js:
- Set with
targetPageParams()function for the page load event (used in the examples on this page) - Set with
targetPageParamsAll()function for all Target requests on the page - Send parameters directly with the
getOffer()function for a single location - Send parameters directly with the
getOffers()function for one or more locations
The Platform Web SDK provides a single consistent way to send data without the need for extra functions. All parameters must be passed in the payload with the sendEvent command and fall under two categories:
- Automatically mapped from the
xdmobject - Manually passed using the
data.__adobe.targetobject
The table below outlines how the example parameters would be remapped using Platform Web SDK:
at_propertysendEvent call.pageNamexdm.web.webPageDetails.namexdm object and conform to a schema using the XDM ExperienceEvent class. Mbox parameters cannot be passed as part of the data object.profile.genderdata.__adobe.target.profile.genderdata object and prefixed with profile. to be mapped appropriately.user.categoryIddata.__adobe.target.user.categoryIddata object.entity.iddata.__adobe.target.entity.idOR
xdm.productListItems[0].SKUdata object or automatically mapped from the first item in the xdm.productListItems array if your implementation uses that field group.entity.categoryIddata.__adobe.target.entity.categoryIddata object.entity.customEntitydata.__adobe.target.entity.customEntitydata object.cartIdsdata.__adobe.target.cartIdsexcludedIdsdata.__adobe.target.excludedIdsmbox3rdPartyIdxdm.identityMap objectorderIdxdm.commerce.order.purchaseIDorderTotalxdm.commerce.order.priceTotalproductPurchasedIddata.__adobe.target.productPurchasedIdOR
xdm.productListItems[0-n].SKUCustom parameters
Custom mbox parameters must be passed as XDM data with the sendEvent command. It is important to ensure that the XDM schema includes all fields required for your Target implementation.
at.js example using targetPageParams():
targetPageParams = function() {
return {
"pageName": "product detail"
};
};
Platform Web SDK JavaScript examples using sendEvent command:
| code language-javascript |
|---|
|
In tags, first use an XDM object data element to map to the XDM field:
And then include your XDM object in your Send event action (multiple XDM objects can be merged):
xdm object you need to update any audiences, activities, or profile scripts that reference these mbox parameters using their new names. See the Update Target audiences and profile scripts for Platform Web SDK compatibility page of this tutorial for more information.Profile parameters
Target profile parameters must be passed under the data.__adobe.target object in the Platform Web SDK sendEvent command payload.
Similar to at.js, all profile parameters must also be prefixed with profile. for the value to be properly stored as a persistent Target profile attribute. The reserved user.categoryId parameter for Target鈥檚 Category Affinity capability is prefixed with user..
at.js example using targetPageParams():
targetPageParams = function() {
return {
"profile.gender": "male",
"user.categoryId": "clothing"
};
};
Platform Web SDK examples using sendEvent command:
| code language-javascript |
|---|
|
In tags, first create a data element to define the data.__adobe.target object:
And then include your data object in your Send event action (multiple objects can be merged):
Entity parameters
Entity parameters are used to pass behavioral data and supplemental catalog information for Target Recommendations. All entity parameters supported by at.js are also supported by the Platform Web SDK. Similar to profile parameters, all entity parameters should be passed under the data.__adobe.target object in the Platform Web SDK sendEvent command payload.
Entity parameters for a specific item must be prefixed with entity. for proper data capture. The reserved cartIds and excludedIds parameters for recommendations algorithms should not be prefixed and the value for each must contain a comma-separated list of entity IDs.
at.js example using targetPageParams():
targetPageParams = function() {
return {
"entity.id": "SKU-00001-LARGE",
"entity.categoryId": "clothing,shirts",
"entity.customEntity": "some value",
"cartIds": "SKU-00002,SKU-00003",
"excludedIds": "SKU-00001-SMALL"
};
};
Platform Web SDK examples using sendEvent command:
| code language-javascript |
|---|
|
In tags, first create a data element to define the data.__adobe.target object:
And then include your data object in your Send event action (multiple objects can be merged):
commerce field group is used and the productListItems array is included in the XDM payload, then the first SKU value in this array is mapped to entity.id for the purposes of incrementing a product view.Purchase parameters
Purchase parameters are passed on an order confirmation page after a successful order and are used for Target conversion and optimization goals. With a Platform Web SDK implementation, these parameters and are automatically mapped from XDM data passed as part of the commerce field group.
at.js example using targetPageParams():
targetPageParams = function() {
return {
"orderId": "ABC123",
"productPurchasedId": "SKU-00002,SKU-00003"
"orderTotal": 1337.89
};
};
Purchase information is passed to Target when the commerce field group has purchases.value set to 1. The order ID and order total are automatically mapped from the order object. If the productListItems array is present, then the SKU values are use for productPurchasedId.
Platform Web SDK example using sendEvent:
| code language-javascript |
|---|
|
In tags, first use an XDM object data element to map to the required XDM fields (see the JavaScript example) and optional custom scope:
And then include your XDM object in your Send event action (multiple XDM objects can be merged):
_experience.decisioning.propositionEventType must be set with display: 1 in order for the call to be used to increment a Target metric.orderConfirmPage, populate the _experience.decisioning.propositions array with a custom scope like in the example above.productPurchasedId value can also be passed as a comma-separated list of entity IDs under the data object.Customer Id (mbox3rdPartyId)
Target allows profile synching across devices and systems using a single customer Id. With at.js, this could be set as the mbox3rdPartyId in the Target request or as the first customer id sent to the Experience Cloud Identity Service. Unlike with at.js, a Platform Web SDK implementation allows you to specify which customer ID to use as the mbox3rdPartyId if there are multiple. For example, if your business has a global customer ID and separate customer IDs for different lines of business, you can configure which ID Target should use.
There are a few steps to set up ID synching for cross-device and Customer Attributes use cases:
- Create an identity namespace for the customer ID in Identities screen of Data Collection or Platform
- Make sure that the alias in Customer Attributes matches the identity symbol of your namespace
- Specify the identy symbol as the Target Third Party ID Namespace in the Target configuration of the datastream
- Execute a
sendEventcommand using theidentityMapfield group
at.js example using targetPageParams():
targetPageParams = function() {
return {
"mbox3rdPartyId": "TT8675309"
};
};
Platform Web SDK examples using sendEvent command:
| code language-javascript |
|---|
|
The ID value, Authenticated state and Namespace are captured in an Identity map data element:
The Identity map data element is then used to set the identityMap field in the XDM object data element:
The XDM object is then included in the Send event action of a rule:
In your datastream鈥檚 51黑料不打烊 Target service, be sure to set the Target Third Party ID Namespace to the same namespace used in the Identity map data element:
Platform Web SDK example
Now that you understand how the different Target parameters are mapped using the Platform Web SDK, our two example pages could be migrated from at.js to the Platform Web SDK as shown below. The example pages include the following:
- Target prehiding snippet for an asynchronous library implementation
- The Platform Web SDK base code
- The Platform Web SDK JavaScript library
- A
configurecommand to initialize the library - A
sendEventcommand to send data and request Target content to be rendered
| code language-html |
|---|
|
| code language-html |
|---|
|
Next, learn how to track Target conversion events with the Platform Web SDK.