Paste the checkout event tracking code below into the Additional scripts field.
Note: Update the site_id
highlighted in red. The site ID is provided by your Onboarding manager. The code should be updated to match your site ID and specific element names.
<!-- RetentionScience start -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.10.0/js/md5.js"></script>
<script type="text/javascript">
{% if first_time_accessed %}
window._rsq = window._rsq || [];
window._rsq.push(['_setSiteId', 'site_id']); // replace site_id with your static Site ID
window._rsq.push(['_enableOnsite']);
{% if customer %}
window._rsq.push(['_setUserId', '{{ customer.id }}']);
window._rsq.push(['_setUserEmail','{{ customer.email }}']);
{% endif %}
/*** EVENT SPECIFIC CODE ***/
window._rsq.push(['_addOrder', { 'id':'{{ order.id }}', 'total':'{{ order.total_price | money_without_currency }}' }]);
{% for item in order.line_items %}
window._rsq.push(['_addItem', { 'id':'{{ item.variant_id }}', 'name':"{{ item.title }}", 'price':'{{item.price | money_without_currency }}' }]);
{% endfor %}
window._rsq.push(['_setAction', 'checkout_success']);
/*** END EVENT SPECIFIC CODE ***/
window._rsq.push(['_track']);
(function() {
var rScix = document.createElement('script');
rScix.type = 'text/javascript';
rScix.async = true;
rScix.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'd1stxfv94hrhia.cloudfront.net/waves/v3/w.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(rScix);
})();
{% endif %}
</script>
<!-- RetentionScience end -->
Comments
0 comments
Please sign in to leave a comment.