Skip to main content

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.

Enhanced Tracking Benefits

Efficiency

The new enhanced tracking library is designed to be more efficient and performant than the legacy system. It uses optimized data structures and improved algorithms to reduce the impact on page load times and improve the overall user experience.

Additional Event Tracking

The enhanced tracking library supports additional event types beyond just purchases, including:

  • Product views
  • Add to cart events
  • Remove from cart events
  • Checkout initiation
  • Cart abandonment

Smart Batching

The new library implements smart batching of events to reduce the number of network requests and improve performance. Events are automatically batched and sent in optimal intervals to minimize the impact on your website's performance.

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 of collect

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>

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.

The old "Conversion Tracking" also published the purchase event to the dataLayer which included what showId or callId the purchase that could be used as an attribution model to attribute to last show or call the user had seen. However, this new purchase tracking will not publish the event to the dataLayer in order to be more aligned with supporting multiple 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.

Enhanced Tracking Benefits

The updated purchase tracking provides several key advantages:

Optimized for efficiency:

  • The updated purchase tracking sends slightly more data than before, but we've made the data package as small as possible
  • Purchase tracking is a low-frequency event and typically runs after the page has loaded, so it does not affect site speed or user experience

Additional event tracking:

  • We recommend adding events such as product-view, add-to-cart, and add-to-wishlist
  • Product-view is the most frequent event and requires adding a small tracking script (only 4.1kB, heavily cached) to PDPs
  • This means it will only affect first-time loads; subsequent loads will use the cached version

Smart batching:

  • All tracking data is queued and sent in batches as late as possible
  • This ensures no noticeable impact on shoppers' browsers, networks, or the overall site experience
  • By implementing these upgrades, you'll gain deeper insights into the full shopper journey, from impressions to video views, add-to-carts, and purchases, with virtually no downside in terms of performance

FAQ

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.

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 of collect

Old Code:
window._bambuser.collect({
  event: "purchase",
  orderId: "12345",
  orderValue: "12345",
  orderProductIds: "11,22,33,44,55",
  currency: "USD"
});

New Code:
window._bambuser.track('purchase', {
  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"
  }]
});

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 website's 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 advanced 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.

The updated purchase tracking provides several key advantages:



Optimized for efficiency:
  • The updated purchase tracking sends slightly more data than before, but we've made the data package as small as possible
  • Purchase tracking is a low-frequency event and typically runs after the page has loaded, so it does not affect site speed or user experience

Additional event tracking:
  • We recommend adding events such as product-view, add-to-cart, and add-to-wishlist
  • Product-view is the most frequent event and requires adding a small tracking script (only 4.1kB, heavily cached) to PDPs
  • This means it will only affect first-time loads; subsequent loads will use the cached version

Smart batching:
  • All tracking data is queued and sent in batches as late as possible
  • This ensures no noticeable impact on shoppers' browsers, networks, or the overall site experience
  • By implementing these upgrades, you'll gain deeper insights into the full shopper journey, from impressions to video views, add-to-carts, and purchases, with virtually no downside in terms of performance

The old "Conversion Tracking" published the purchase event to the dataLayer which included what showId or callId the purchase could be used as an attribution model to attribute to last show or call the user had seen.



However, this new purchase tracking will not publish the event to the dataLayer in order to be more aligned with supporting multiple attribution models.