Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sentient Ascend - Shopify Integration - Conversion Goal - Revenu
{% if first_time_accessed %}
<script type="text/javascript">
function createCookie(name, value, days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + value + expires + ";";
}
var cookieContent = "{{checkout.attributes.ascend}}";
createCookie('_ascend_index', '[%22_ascend_current%22]', 100);
createCookie('_ascend_current', cookieContent, 100);
</script>
<!-- ADD YOUR ASCEND.JS SNIPPET HERE!!--><script src="//media.ascend.ai/c/XXXXXXXXX-XXX/ascend.js"></script>
<script type="text/javascript">
var revenue = document.querySelector('.total-recap__final-price').textContent.slice(1);
var finalRevenue = parseFloat(revenue);
Ascend.Goals.trigger(finalRevenue); // track revenue
</script>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.