Migrate from Legacy Conversion Tracking to Enhanced Tracking
This page describes how to migrate from the legacy conversion tracking to the new enhanced tracking library. The new library allows you to track shopper events for all Bambuser products in a unified way.
The key benefits of the new enhanced tracking functions are:
- More detailed insights in product conversions: The new library provides more detailed insights into product conversions, allowing you to track the performance of individual products rather than just total conversion.
- Multi-market support: The new library supports multi-market tracking, allowing you to track shopper events across different markets and regions.
- Improved data quality: The new library provides better data quality and accuracy for tracking shopper events. Handling duplicate events in a more robust way.
- Improved performance: The new library is designed to be more performant and efficient, reducing the impact on page load times and improving the overall user experience.
- Unified tracking: The new library allows you to track shopper events for all Bambuser products in a unified way.
Required code change
Only a few changes are needed to migrate from the legacy conversion tracking to the new enhanced tracking library.
- Send new more detailed data structure
- Use helper method
track
instead ofcollect
Old Code
<script>
// Your existing purchase handling function
function onPurchase() {
// Properties below should be named in this exact way!
// Replace the values
var data = {
event: "purchase", // value needs to be “purchase”
orderId: "12345", // the order id (String)
orderValue: "12345", // total of all products in the order (Number or String of numbers)
orderProductIds: "11,22,33,44,55", // comma-separated string, or array of all product ids in the order
currency: "USD", // the currency used for the order (ISO 4217)
};
// Send the data to Bambuser
window._bambuser.collect(data);
}
</script>
New Code
<script>
// Your existing purchase handling function
function onPurchase() {
const data = {
eventType: "purchase",
transaction: {
id: "abcd",
subtotal: 70.99,
currency: "USD",
total: 74.98,
tax: 14.2,
shippingCost: 3.99,
shippingMethod: "Store pickup",
coupon: "SUMMER_SALE",
},
products: [
{
id: "314-7216-102",
name: "Tennis Shoe Classic - Size 10",
image: "https://example.com/images/314-7216-102.jpg",
price: 70.99,
currency: "USD",
quantity: 1,
brand: "Plausible Co.",
category: "Footwear > Sports > Tennis",
location: "https://example.com/products/314-7216",
},
],
};
// Send the data to Bambuser
window._bambuser.track('purchase', data);
}
</script>
Allow new cookie
The Bambuser cookie _bamls_ltce
is used to store what data regions the shopper has interacted with and how long
the user should be tracked for. This cookie is set to expire after 30 days.
How to allow the new cookie?: Ensure your websites cookie policy is up-to-date with Bambuser's described cookies. Then ask support@bambuser.com to activate this new cookie for your BamHub.
By allowing this cookie you would unlock two new potentials:
More attribution models than "last interaction"
The new cookie only tells how long a user should be tracked and does not mix in data around which show, call, video, or chat to attribute the event towards. This is a preparation to be able to provide more smart and anvanced attribution models.
Multi-region support
A common setup is to have one domain for all your markets.
For example, you serve your US market on merchant.com/en-US
and your UK market on merchant.com/en-GB
.
If you have different BamHubs for each market and they are located in different data regions (EU vs. US), you would have limitations in terms of tracking purchases to both of these BamHubs and therefore would most likely be missing some of your purchase tracking.