attaching shopify_cart_token as external id
browser.cookie.get('cart').then(function(cart_token){
fetch("//io.v2.customerlabs.co/externalIds?shopify_cart_token=" + cart_token + "&id=" + window.CLabsgbVar.appId + "&uid=" + window.CLabsgbVar.generalProps.uid);
}).catch(function(e){
console.log("clabs cart token collection issue", e)
});
fetch('/cart/update.js', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: 'attributes[customerlabs_id]=' + window.CLabsgbVar.generalProps.uid
}).then(function (response) {
return response.json();
}).then(function (data) {
console.log('Success:', data);
}).catch(function (error) {
console.error('Error:', error);
})