Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save clientlab-dev/9c6488fdd583ccf369116f0e294af0f9 to your computer and use it in GitHub Desktop.
Save clientlab-dev/9c6488fdd583ccf369116f0e294af0f9 to your computer and use it in GitHub Desktop.
<script>
try{
//window.dataLayer = window.dataLayer || [];
dataLayer.push({
'ecommerce': {
'purchase': {
'actionField': {
'id': $('.modal-container').text().match(/\d+/g)[0]*1, // Transaction ID. Required for purchases and refunds.
'revenue': currentPrice * productQuantity, // Total transaction value (incl. tax and shipping)
},
'products': [{
brand: "",
category: "",
id: productId,
name: productName,
price: currentPrice,
quantity: productQuantity,
variant: ""
}]
}
}
});
dataLayer.push({'event': 'purchase'});
yaCounter16150147.reachGoal('ONE_CLICK_ORDER');
console.log('ya_goal','ONE_CLICK_ORDER');
}catch(e){
console.log('e', e);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment