Created
November 4, 2019 21:46
-
-
Save taf2/387a8497d68bc4043733030ca725c00a to your computer and use it in GitHub Desktop.
Tracking visitor_sid with Shopify orders
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
<input type="hidden" name="attributes[visitor_sid]" id="ctm_visitor_sid" value=""/> | |
<script> | |
function getCookie(name) { | |
var nameEQ = name + "="; | |
var ca = document.cookie.split(';'); | |
for(var i=0, len = ca.length;i < len;i++) { | |
var c = ca[i]; | |
while (c.charAt(0)==' ') c = c.substring(1,c.length); | |
if (c.indexOf(nameEQ) == 0) { | |
return c.substring(nameEQ.length,c.length); | |
} | |
} | |
return null; | |
} | |
document.getElementById('ctm_visitor_sid').value=getCookie('__ctmid'); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment