Shopify + Video Consultation
This is our recommended approach for integrating to Shopify. You may of course modify the code based on your wishes following the general documentation.
In order to integrate the Bambuser Calls Widget into a Shopify store, you will need to add Bambuser related integration code to your Shopify website. The integration code can be added by adding script tags to your page content or theme codes.
Steps:
Due to Shopify's technical limitations, the Cobrowsing, Surf While in Queue and Miniplayer features are not compatible with Shopify stores. You can read more about the compatibility here.
Integrationβ
Sample integration codeβ
Below you find a sample integration code that implements:
- Overlay Widget
- Provide Product Data
- Provide Search Data
- Cart Integration
This sample code works on almost all Shopify stores that have standard product models without any changes required. However, if you have a special product setup, you may need to modify the code to justify that with your case.
Note that before you will have to modify your embed code a bit in order to make it work as you want
1. Organization ID (mandatory)β
For the Calls Widget initiation to work, you will need to enter your own organization ID (
orgId
). That means that you need to have access to Bambuser Workspace.Your orgId can be found in Bambuser workspace URL (
https://lcx.bambuser.com/o/[orgId]/...
)2. Queue ID (optional)β
Bambuser Video Consultation product comes with a built-in queing system. Workspace admins can configure different queues in Bambuser workspace. Each queue will get its own unique ID when created.
Each queue will have a
Queue ID
, which Video Consultation Admin can find in Queue Settings within Bambuser Workspace.If you want to redirect your end customers to a different queue that the default one, you will need to additionaliy specify that in the below code sample.
3. Embed Source URL (optional)β
Embed source URL is different depending on location of servers that your workspace is set up on. Note that below sample code is assuming your workspace is setup on Global Servers.
- Global Servers
- EU Servers
Use Global servers URL
https://one-to-one.bambuser.com/embed.js
if the login to your Bambuser workspace is on following link: https://lcx.bambuser.com/. If that is the case, you do not need to make those changes in the code below.Use European servers URL
https://one-to-one.bambuser.com/eu/embed.js
if the login to your Bambuser workspace is on following link: https://lcx-eu.bambuser.com/. If this is the case, make sure to modify this in the code below.
SAMPLE INTEGRATION CODE
- Cart integration code
- Sample product data
<script>
// ====================================== Define constants ========================================
// Reduces server calls if a product has a crazy number of images.
const MAX_IMAGES_COUNT_ = 20;
// Extracts product handle (and variantID) from the product URL
// Group[1] => product handle (Group[3] => variant ID)
const SHOPIFY_PRODUCT_URL_HANDLE_REGEX_ = /\/products\/(.[\w\d-+]+)/;
// ====================================== General helper methods for Shopify ========================================
// Sometimes image URLs miss the protocol at the beginning
// E.g. '//cdn.shopify.com/s/files/.../image.jpg'
window.urlSanitizer_ = (url) => {
if (typeof url === 'string') {
if (url.startsWith('//')) return `https:${url}`;
else if (url.toLocaleLowerCase().startsWith('http')) return url;
else console.log(`Not a valid URL: ${url}`);
} else console.log(`Not a valid URL: ${url}`);
return null;
};
window.getActiveCurrency = () => {
// 1. From the Shopify object
const getCurrencyFromContext = Shopify?.currency?.active;
if (getCurrencyFromContext) return getCurrencyFromContext;
// 2. From the 'cart_currency' cookie
const currencyFromCookies = document.cookie
.split('; ')
.find((row) => row.startsWith('cart_currency'))
?.split('=')[1];
if (currencyFromCookies) return currencyFromCookies;
// If no currency found
return null;
};
// ====================================== Shopify Ajax API Helper methods ========================================
const oneToOneStoreApi = {};
oneToOneStoreApi.getProductByUrl = (url) => {
const handle = SHOPIFY_PRODUCT_URL_HANDLE_REGEX_.exec(url);
return fetch('/products/' + handle[1] + '.js', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
}).then((resp) => resp.json());
};
oneToOneStoreApi.getProductByHandle = (handle) => {
return fetch('/products/' + handle + '.js', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
}).then((resp) => resp.json());
};
oneToOneStoreApi.getRelatedProducts = (productId) => {
return fetch(
window.Shopify.routes.root +
'recommendations/products.json?product_id=' +
[productId] +
'&limit=5'
).then((response) => response.json());
};
oneToOneStoreApi.getProduct = (ref) => {
if (SHOPIFY_PRODUCT_URL_HANDLE_REGEX_.test(ref)) {
return oneToOneStoreApi.getProductByUrl(ref).then((productObject) => {
return oneToOneStoreApi
.getRelatedProducts(productObject.id)
.then((result) => {
productObject['relatedProducts'] = result.products;
return productObject;
});
});
} else {
return oneToOneStoreApi
.getProductByHandle(ref.split(':')[1])
.then((productObject) => {
return oneToOneStoreApi
.getRelatedProducts(productObject.id)
.then((result) => {
productObject['relatedProducts'] = result.products;
return productObject;
});
});
}
};
oneToOneStoreApi.predictiveSearch = (query) =>
fetch(
'/search/suggest.json?q=' +
query +
'&resources[type]=product&resources[options][fields]=title,product_type,variants.title,variants.sku,variants.barcode,vendor',
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
}
).then((res) => res.json());
oneToOneStoreApi.addToCart = (itemId) =>
fetch('/cart/add.js', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
items: [
{
quantity: 1,
id: itemId.split(':')[0],
},
],
}),
}).then((resp) => resp.json());
oneToOneStoreApi.updateItemInCart = (itemId, quantity) =>
fetch('/cart/update.js', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
updates: {
[itemId.split(':')[0]]: quantity,
},
}),
}).then((resp) => resp.json());
oneToOneStoreApi.getCartState = () =>
fetch('/cart.js', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
}).then((resp) => resp.json());
// ===================================== Bambuser OneToOneReady Handler ==========================================
function onBambuserOneToOneReady() {
// This method will be invoked when embed.js has loaded and Bambuser
// Calls API is available.
// Creating an instance directly will allow to detect connect links
// that will automatically open the Live Meeting overlay on page load.
let oneToOneEmbed = new BambuserOneToOneEmbed({
orgId: '[ORG_ID]',
// queue: '[QUEUE_ID_HERE]', // if not specified, default queue configured from the workspace will get applied
triggers: [
'smart', // activate the overlay widget
'connect-link', // activate the connect link - Unrelated to OLW, yet mandatory
],
smartVariantOverride: 'Video', // force variant 'Video'. Other options are 'Avatar' and 'Side dock'
popupTimeoutSeconds: '5', // after how many seconds OLW appears on the first time page load (default = 60)
});
//------------------------------------ Provide Product Data ----------------------------------
oneToOneEmbed.on('provide-product-data', (event) => {
event.products.forEach(({ ref, id }) => {
oneToOneStoreApi.getProduct(ref).then((item) => {
oneToOneEmbed.updateProduct(id, (productFactory) =>
productFactory
.currency(getActiveCurrency() || 'USD')
.locale('en-US')
.product((detailFactory) =>
detailFactory
.name(item.title)
.description(item.description)
.sku(item.id + ':' + item.handle)
.attributes((attribute) => {
if (item.variants && item.variants.length > 1) {
return item.options.map((attr) =>
attribute(attr.name)
.name(attr.name)
.options((option) =>
attr.values.map((optionName) =>
option(optionName).name(optionName)
)
)
);
} else {
return [];
}
})
.defaultVariationIndex()
.variations((variationFactory) => {
return item.variants.map((variation) =>
variationFactory()
// If there is more than one variation, append variation title to the item title
.name(
variation.title === 'Default Title'
? item.title
: item.title + ` (${variation.title})`
)
.sku(variation.id + ':' + item.handle)
.inStock(variation.available)
.imageUrls([
// Adding the featured image of the chosen variation
// (if existed) at the beginning of the images array
...(variation.featured_image
? [variation.featured_image.src]
: []),
// Adding product images
...item.images
.slice(0, MAX_IMAGES_COUNT_ - 1)
.map((url) => urlSanitizer_(url))
.filter((url) => typeof url === 'string')
.filter(
(image) =>
image !==
(variation.featured_image !== null
? variation.featured_image.src
: null)
),
])
.price((priceFactory) =>
priceFactory
.original(variation.compare_at_price / 100)
.current(variation.price / 100)
)
.attributes((attribute) => {
if (item.variants && item.variants.length > 1) {
return item.options.map((attr) =>
attribute(
attr.name,
variation['option' + attr.position]
)
);
} else {
return [];
}
})
.relatedProducts((relatedProductFactory) =>
item.relatedProducts.map((relatProd) =>
relatedProductFactory()
.title(relatProd.title)
.sku(relatProd.id + ':' + relatProd.handle)
.imageUrl(urlSanitizer_(relatProd.featured_image))
.price((priceFactory) =>
priceFactory
.original(relatProd.compare_at_price / 100)
.current(relatProd.price / 100)
)
)
)
);
})
)
);
});
});
});
// --------------------------------- Cart Integrations --------------------------------------
oneToOneEmbed.on('should-add-item-to-cart', (addedItem, callback) => {
oneToOneStoreApi
.addToCart(addedItem.sku)
.then((res) => {
if (res.items) {
callback(true);
console.log('Item added succussfully!');
} else if (res.description && res.description.includes('sold out')) {
callback({
success: false,
reason: 'out-of-stock',
});
} else callback(false);
})
.catch((error) => {
callback(false);
console.error('Add to cart error! ', error);
});
});
oneToOneEmbed.on('should-update-item-in-cart', (updatedItem, callback) => {
oneToOneStoreApi
.updateItemInCart(updatedItem.sku, updatedItem.quantity)
.then((res) => {
if (res.items) {
callback(true);
console.log('Item updated succussfully!');
} else callback(false);
})
.catch((error) => {
callback(false);
console.error('Error on updating item! ', error);
});
});
oneToOneEmbed.on('goto-checkout', () => {
window.open(window.location.origin + '/cart', '_blank');
});
// --------------------------------- Provide Search Data -------------------------------------
oneToOneEmbed.on('provide-search-data', (searchRequest, searchResponse) => {
const { term, page } = searchRequest;
// ==== 1. If search by inserting a product URL (check using regex) ====
const matchGroups = SHOPIFY_PRODUCT_URL_HANDLE_REGEX_.exec(term);
// If term contains a URL matches[1] holds the product handle.
if (matchGroups && typeof matchGroups[1] == 'string' && matchGroups[1].length > 0) {
const productHandle = matchGroups[1];
oneToOneStoreApi
.getProductByHandle(productHandle)
.then((productData) => {
searchResponse((responseFactory) => {
return responseFactory
.products((productFactory) => {
return [
productFactory()
.name(productData.title)
.imageUrl(urlSanitizer_(productData.featured_image))
.sku(productData.id + ':' + productData.handle)
.price((priceFactory) =>
priceFactory
.current(productData.price / 100)
.original(productData.compare_at_price_max / 100)
),
];
})
.currency(getActiveCurrency())
.locale('en-US');
});
});
return;
}
// ==== 2. If searched by a title, product_type, variants.title, variants.sku, variants.barcode, or vendor ====
oneToOneStoreApi.predictiveSearch(term).then((data) => {
if (data.status && data.status === 422) throw new Error(data.message);
searchResponse((responseFactory) => {
return responseFactory
.products((productFactory) => {
const results = data.resources.results.products.map(
(productData) => {
return productFactory()
.name(productData.title)
.imageUrl(productData.image)
.sku(productData.id + ':' + productData.handle)
.price((priceFactory) =>
priceFactory
.current(parseInt(productData.price))
.original(parseInt(productData.compare_at_price_max))
);
}
);
return results;
})
.currency(getActiveCurrency())
.locale('en-US');
});
});
});
}
</script>
<script id="bambuser-one-to-one" async src="https://one-to-one.bambuser.com/embed.js"></script>
{
"id":3780507959318,
"title":"Stratus Backpack",
"handle":"stratus-backpack",
"description":"\u003cmeta charset=\"utf-8\"\u003e\n\u003cp\u003e\u003ci\u003eThis is a demonstration store. You can purchase products like this from\u003cspan\u003e \u003ca href=\"https://caraasport.com\" title=\"Caraa\"\u003eCaraa\u003c/a\u003e\u003c/span\u003e.\u003c/i\u003e\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003eLight as air. The Stratus is encased in cloud-like waterproof nylon and features exterior + interior pockets for your water bottle, umbrella, and laptop. Reach around to the side for on-the-go access to the main compartment. Collapse it for easy travel. Your backpack just got an upgrade.\u003c/span\u003e\u003c/p\u003e",
"published_at":"2020-03-09T16:13:44-04:00",
"created_at":"2020-03-09T16:13:50-04:00",
"vendor":"debut-rich-media-demo",
"type":"",
"tags":[],
"price":17500,
"price_min":17500,
"price_max":19500,
"available":true,
"price_varies":true,
"compare_at_price":null,
"compare_at_price_min":0,
"compare_at_price_max":0,
"compare_at_price_varies":false,
"variants":[
{
"id":29013951414294,
"title":"Navy",
"option1":"Navy",
"option2":null,
"option3":null,
"sku":"",
"requires_shipping":true,
"taxable":true,
"featured_image":{
"id":4721544527894,
"product_id":3780507959318,
"position":1,
"created_at":"2020-03-09T16:13:51-04:00",
"updated_at":"2020-03-09T16:13:51-04:00",
"alt":null,
"width":1058,
"height":1039,
"src":"https://cdn.shopify.com/s/files/1/0260/1061/5830/products/main_backpack.png?v=1583784831",
"variant_ids":[
29013951414294
]
},
"available":true,
"name":"Stratus Backpack - Navy",
"public_title":"Navy",
"options":[
"Navy"
],
"price":17500,
"weight":0,
"compare_at_price":null,
"inventory_management":"shopify",
"barcode":"",
"featured_media":{
"alt":null,
"id":1459887833110,
"position":1,
"preview_image":{
"aspect_ratio":1.018,
"height":1039,
"width":1058,
"src":"https://cdn.shopify.com/s/files/1/0260/1061/5830/products/main_backpack.png?v=1583784831"
}
}
},
{
"id":29013951447062,
"title":"Black",
"option1":"Black",
"option2":null,
"option3":null,
"sku":"",
"requires_shipping":true,
"taxable":true,
"featured_image":{
"id":4721544658966,
"product_id":3780507959318,
"position":4,
"created_at":"2020-03-09T16:13:51-04:00",
"updated_at":"2020-03-11T10:45:10-04:00",
"alt":null,
"width":1058,
"height":1039,
"src":"https://cdn.shopify.com/s/files/1/0260/1061/5830/products/stratus_03.png?v=1583937910",
"variant_ids":[
29013951447062
]
},
"available":true,
"name":"Stratus Backpack - Black",
"public_title":"Black",
"options":[
"Black"
],
"price":19500,
"weight":0,
"compare_at_price":null,
"inventory_management":"shopify",
"barcode":"",
"featured_media":{
"alt":null,
"id":1459887964182,
"position":5,
"preview_image":{
"aspect_ratio":1.018,
"height":1039,
"width":1058,
"src":"https://cdn.shopify.com/s/files/1/0260/1061/5830/products/stratus_03.png?v=1583784831"
}
}
},
{
"id":29013951479830,
"title":"Red",
"option1":"Red",
"option2":null,
"option3":null,
"sku":"",
"requires_shipping":true,
"taxable":true,
"featured_image":null,
"available":false,
"name":"Stratus Backpack - Red",
"public_title":"Red",
"options":[
"Red"
],
"price":17500,
"weight":0,
"compare_at_price":null,
"inventory_management":"shopify",
"barcode":""
}
],
"images":[
"//cdn.shopify.com/s/files/1/0260/1061/5830/products/main_backpack.png?v=1583784831",
"//cdn.shopify.com/s/files/1/0260/1061/5830/products/stratus_01.png?v=1583937910",
"//cdn.shopify.com/s/files/1/0260/1061/5830/products/stratus_02.png?v=1583937910",
"//cdn.shopify.com/s/files/1/0260/1061/5830/products/stratus_03.png?v=1583937910"
],
"featured_image":"//cdn.shopify.com/s/files/1/0260/1061/5830/products/main_backpack.png?v=1583784831",
"options":[
{
"name":"Color",
"position":1,
"values":[
"Navy",
"Black",
"Red"
]
}
],
"url":"/products/stratus-backpack",
"media":[
{
"alt":null,
"id":1459887833110,
"position":1,
"preview_image":{
"aspect_ratio":1.018,
"height":1039,
"width":1058,
"src":"https://cdn.shopify.com/s/files/1/0260/1061/5830/products/main_backpack.png?v=1583784831"
},
"aspect_ratio":1.018,
"height":1039,
"media_type":"image",
"src":"https://cdn.shopify.com/s/files/1/0260/1061/5830/products/main_backpack.png?v=1583784831",
"width":1058
},
{
"alt":null,
"id":1461301641238,
"position":2,
"preview_image":{
"aspect_ratio":1.0,
"height":1024,
"width":1024,
"src":"https://cdn.shopify.com/s/files/1/0260/1061/5830/products/StratusBag.jpg?v=1583937876"
},
"media_type":"model",
"sources":[
{
"format":"glb",
"mime_type":"model/gltf-binary",
"url":"https://model3d.shopifycdn.com/models/o/5f491746c036baf6/StratusBag.glb"
},
{
"format":"usdz",
"mime_type":"model/vnd.usdz+zip",
"url":"https://model3d.shopifycdn.com/models/o/c3b4ad9cbc191499/StratusBag.usdz"
}
]
},
{
"alt":null,
"id":1459887865878,
"position":3,
"preview_image":{
"aspect_ratio":1.018,
"height":1039,
"width":1058,
"src":"https://cdn.shopify.com/s/files/1/0260/1061/5830/products/stratus_01.png?v=1583784831"
},
"aspect_ratio":1.018,
"height":1039,
"media_type":"image",
"src":"https://cdn.shopify.com/s/files/1/0260/1061/5830/products/stratus_01.png?v=1583784831",
"width":1058
},
{
"alt":null,
"id":1459887931414,
"position":4,
"preview_image":{
"aspect_ratio":1.018,
"height":1039,
"width":1058,
"src":"https://cdn.shopify.com/s/files/1/0260/1061/5830/products/stratus_02.png?v=1583784831"
},
"aspect_ratio":1.018,
"height":1039,
"media_type":"image",
"src":"https://cdn.shopify.com/s/files/1/0260/1061/5830/products/stratus_02.png?v=1583784831",
"width":1058
},
{
"alt":null,
"id":1459887964182,
"position":5,
"preview_image":{
"aspect_ratio":1.018,
"height":1039,
"width":1058,
"src":"https://cdn.shopify.com/s/files/1/0260/1061/5830/products/stratus_03.png?v=1583784831"
},
"aspect_ratio":1.018,
"height":1039,
"media_type":"image",
"src":"https://cdn.shopify.com/s/files/1/0260/1061/5830/products/stratus_03.png?v=1583784831",
"width":1058
}
]
}
To learn more about different ways to initiate the Calls Widget or different embedding options, read the Initial Setup guide.
In the next section, we explain how you should add the integration code into your Shopify store.
Adding integration code to your Shopifyβ
There are different ways to add the integration code to the Shopify store. You need to make sure that your integration code is included in all pages that you want have the Calls Widget embedded on.
- All pages (Recommended)
- Specific page/s
- In your Shopify theme codes, create a snippet and add the sample integration code there.
- Assuming that you named the snippet
bambuser-call-widget.liquid
, add this snippet to thetheme.liquid
layout as below:
{% render 'bambuser-call-widget'%}
- In your Shopify theme codes, create a snippet and add the sample integration code there.
- Assuming that you named the snippet
bambuser-call-widget.liquid
, add this snippet to thetheme.liquid
layout as below:
{% render 'bambuser-call-widget'%}
The resultβ
Once you added the code snippet to your page/s, you should be seeing the following behaviour:
- Overlay Widget triggers on page load and can initialize Calls Widget
- Calls Widget appears in the middle of the screen
- You can call to the queue
- Agent can pickup the call from Bambuser Agent Tool (Desktop/App)
- Agent can search for products in the call
- Agent can pull the products to the call
- Agent can compare the products
- Agent can add product to the caller's cart
- Both Agent and Caller can modify cart quantity in the call
- Caller can go to checkout, which will open in the new tab
Conversion Tracking on Shopifyβ
Adding the Bambuser Conversion Tracking to your Shopify store enables your team to track sales that are attributed to Bambuser shows.
Implement via Shopify Custom Pixelβ
Implement Bambuser Conversion Tracking in your Shopify store using a Shopify Custom Pixel.
- Log in to your Shopify Admin workspace
- From the bottom-left select
Settings
- Choose
Customer
events from the left menu - From the top-right, click on
Add custom pixel
- Give it a name and click
Add Pixel
- You should see a code box. If there are some codes already in the code box please remove them.
- Copy the code below (Select Global/EU servers based on your account's region!), and paste it on the Custom Pixel code box.
- Press Save and then press Connect
- Global Servers
- EU Specific Servers
Tracking library URL is different depending on location of servers that your workspace is set up on. Use Global servers URL https://cdn.liveshopping.bambuser.com/metrics/bambuser.min.js
if the login to your Bambuser workspace is on following link: https://lcx.bambuser.com/.
// ---------------------------------------------------------
// Bambuser Conversion Tracking for Shopify Pixels.
// Shopify Admin -> Settings -> Customer events
// ---------------------------------------------------------
// (IMPORTANT)
// Change the value to true only if your Bambuser workspace's base URL matches lcx-eu.bambuser.com
const USE_EU_SERVER = false;
// ---------------------------------------------------------
// For debugging
const LOGGING_ENABLED = false;
// ---------------------------------------------------------
// Subscribe to customer events using the analytics.subscribe() API
analytics.subscribe('checkout_completed', (event) => {
LOGGING_ENABLED && console.log('π - Running Conversion Tracking Customer Event...');
const checkout = event.data.checkout;
// Send the conversion data above to Bambuser
function onPurchaseBambuser () {
var data = {
event: 'purchase', // value needs to be βpurchaseβ
orderId: checkout.order.id, // The order id
orderValue: checkout.totalPrice.amount, // Total gross order value
currency: checkout.totalPrice.currencyCode, // The currency used for the order value
orderProductIds: checkout.lineItems.map((item) => item.id.toString()), // Array or comma-separated string of all product ids in the order
};
// Send the conversion data above to Bambuser
window._bambuser.collect(data);
LOGGING_ENABLED && console.log('π - If relevant, the purchase should be collected now!', data);
}
// Load the tracking library and sec invoke onPurchase() method
LOGGING_ENABLED && console.log('π - Mounting tracking script!');
var bamSrcElm = document.createElement('script');
bamSrcElm.src = USE_EU_SERVER ? 'https://cdn.liveshopping.bambuser.com/metrics/bambuser-eu.min.js' : 'https://cdn.liveshopping.bambuser.com/metrics/bambuser.min.js';
bamSrcElm.onload = onPurchaseBambuser;
document.body.appendChild(bamSrcElm);
});
Tracking library URL is different depending on location of servers that your workspace is set up on. Use European servers URL https://cdn.liveshopping.bambuser.com/metrics/bambuser-eu.min.js
if the login to your Bambuser workspace is on following link: https://lcx-eu.bambuser.com/.
// ---------------------------------------------------------
// Bambuser Conversion Tracking for Shopify Pixels.
// Shopify Admin -> Settings -> Customer events
// ---------------------------------------------------------
// (IMPORTANT)
// Change the value to true only if your Bambuser workspace's base URL matches lcx-eu.bambuser.com
const USE_EU_SERVER = true;
// ---------------------------------------------------------
// For debugging
const LOGGING_ENABLED = false;
// ---------------------------------------------------------
// Subscribe to customer events using the analytics.subscribe() API
analytics.subscribe('checkout_completed', (event) => {
LOGGING_ENABLED && console.log('π - Running Conversion Tracking Customer Event...');
const checkout = event.data.checkout;
// Send the conversion data above to Bambuser
function onPurchaseBambuser () {
var data = {
event: 'purchase', // value needs to be βpurchaseβ
orderId: checkout.order.id, // The order id
orderValue: checkout.totalPrice.amount, // Total gross order value
currency: checkout.totalPrice.currencyCode, // The currency used for the order value
orderProductIds: checkout.lineItems.map((item) => item.id.toString()), // Array or comma-separated string of all product ids in the order
};
// Send the conversion data above to Bambuser
window._bambuser.collect(data);
LOGGING_ENABLED && console.log('π - If relevant, the purchase should be collected now!', data);
}
// Load the tracking library and sec invoke onPurchase() method
LOGGING_ENABLED && console.log('π - Mounting tracking script!');
var bamSrcElm = document.createElement('script');
bamSrcElm.src = USE_EU_SERVER ? 'https://cdn.liveshopping.bambuser.com/metrics/bambuser-eu.min.js' : 'https://cdn.liveshopping.bambuser.com/metrics/bambuser.min.js';
bamSrcElm.onload = onPurchaseBambuser;
document.body.appendChild(bamSrcElm);
});
Troubleshootingβ
If you have any issues, check out the Conversion Tracking troubleshooting checklist. To find out more, see the Bambuser Conversion Tracking π documentation.