Last active
November 2, 2020 02:47
-
-
Save clientlab-dev/9c6488fdd583ccf369116f0e294af0f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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