Purchase event
The purchase event is a value in the events
variable. This value is useful for organizations that want to collect data around the revenue that their site generates. It is heavily dependent on the products
and purchaseID
variables.
When you set a purchase event, it affects the following metrics:
- The 鈥極rders鈥 metric increments by 1
- The 鈥楿nits鈥 metric increments by the number of products in the
products
variable - The 鈥楻evenue鈥 metric increases by the sum of price parameters in the
products
variable
s.products="Womens;Socks;5;4.50"
does not pass $22.50 into revenue; it passes $4.50. Make sure that your implementation passes the total revenue for the quantity listed. For example, s.products="Womens;Socks;5;22.50"
.Set the purchase event using the Web SDK
If using the XDM object, the purchase event uses the following XDM fields:
- Orders are mapped to
xdm.commerce.purchases.value
. - Units are mapped to the sum of all
xdm.productListItems[].quantity
fields. Seeproducts
for more information. - Revenue is mapped to the sum of all
xdm.productListItems[].priceTotal
fields.
{
"xdm": {
"commerce": {
"purchases": {
"value": 1
}
}
}
}
If using the data object, the purchase event uses data.__adobe.analytics.events
, following AppMeasurement string syntax.
{
"data": {
"__adobe": {
"analytics": {
"events": "purchase"
}
}
}
}
Set the purchase event using the 蜜豆视频 Analytics extension
- Log in to using your 蜜豆视频ID credentials.
- Click the desired tag property.
- Go to the Rules tab, then click the desired rule (or create a rule).
- Under Actions, click an existing 蜜豆视频 Analytics - Set Variables action or click the 鈥+鈥 icon.
- Set the Extension drop-down list to 蜜豆视频 Analytics, and the Action Type to Set Variables.
- Locate the Events section, and set the Events drop-down list to purchase.
Other dependent variables like products
and purchaseID
do not have dedicated fields in the Analytics extension within 蜜豆视频 Experience Platform Data Collection. Use the custom code editor following AppMeasurement syntax for these variables.
Set the purchase event in AppMeasurement and the Analytics extension custom code editor
The purchase event is a string that is set as part of the events variable.
// Set the purchase event by itself
s.events = "purchase";
// Set the purchase event alongside other events
s.events = "purchase,event1,event2";
Purchase event de-duplication
When you fire a purchase event, 蜜豆视频 checks the following:
- Does the hit contain the
purchaseID
variable? If not, 蜜豆视频 uses information from the hit to create a 鈥渢emporary purchase ID鈥. This temporary purchase ID only applies to the visitor of the hit. The previous 5 temporary purchase ID鈥檚 are stored for each visitor ID per report suite. - Does the temporary purchase ID match any of the last five stored temporary purchase IDs? If so, the image request is considered a duplicate purchase. All conversion variables, including the purchase event, do not appear in reporting.
- If the
purchaseID
variable is defined, does it match any value already collected in the report suite across all visitors? If so, the image request is considered a duplicate purchase. All conversion variables, including the purchase event, do not appear in reporting.