Created
May 30, 2017 17:57
-
-
Save samnazari/4856a6eadcf8e9bf13a3ace2e7ae6cfd to your computer and use it in GitHub Desktop.
Sentient Ascend - Shopify Integration - Conversion Goal - Revenu
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
{% 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