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’s 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
xdm
object - Manually passed using the
data.__adobe.target
object
The table below outlines how the example parameters would be remapped using Platform Web SDK:
at_property
sendEvent
call.pageName
xdm.web.webPageDetails.name
xdm
object and conform to a schema using the XDM ExperienceEvent class. Mbox parameters cannot be passed as part of the data
object.profile.gender
data.__adobe.target.profile.gender
data
object and prefixed with profile.
to be mapped appropriately.user.categoryId
data.__adobe.target.user.categoryId
data
object.entity.id
data.__adobe.target.entity.id
OR
xdm.productListItems[0].SKU
data
object or automatically mapped from the first item in the xdm.productListItems
array if your implementation uses that field group.entity.categoryId
data.__adobe.target.entity.categoryId
data
object.entity.customEntity
data.__adobe.target.entity.customEntity
data
object.cartIds
data.__adobe.target.cartIds
excludedIds
data.__adobe.target.excludedIds
mbox3rdPartyId
xdm.identityMap
objectorderId
xdm.commerce.order.purchaseID
orderTotal
xdm.commerce.order.priceTotal
productPurchasedId
data.__adobe.target.productPurchasedId
OR
xdm.productListItems[0-n].SKU
Custom 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:
{modal="regular"}
And then include your XDM object in your Send event action (multiple XDM objects can be merged):
{modal="regular"}
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’s 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:
{modal="regular"}
And then include your data object in your Send event action (multiple objects can be merged):
{modal="regular"}
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:
{modal="regular"}
And then include your data object in your Send event action (multiple objects can be merged):
{modal="regular"}
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 examples using sendEvent
command:
code language-javascript |
---|
|
In tags, first use an XDM object data element to map to the XDM fields:
{modal="regular"}
And then include your XDM object in your Send event action (multiple XDM objects can be merged):
{modal="regular"}
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 Target 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
sendEvent
command using theidentityMap
field 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:
{modal="regular"}
The Identity map data element is then used to set the identityMap field in the XDM object data element:
{modal="regular"}
The XDM object is then included in the Send event action of a rule:
{modal="regular"}
In your datastream’s Adobe Target service, be sure to set the Target Third Party ID Namespace to the same namespace used in the Identity map data element:
{modal="regular"}
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
configure
command to initialize the library - A
sendEvent
command 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.