I have set a cookie whenever a user clicks through one of our affiliate links and lands on our site with "src=uni" in the URL. The URLs looks something like this: http://ift.tt/1d0QozU]
My Script to set cookie:
function SetCookie() {
var url = window.location.search;
if(url.indexOf('?src=uni') !== -1)
document.cookie="src=uni";
}
When a user makes a purchase, I want the site to look for this cookie on my Receipt page and if it's present, then the tag should have 'FIREuni' : 'TRUE'. If the cookie is not present, the tag should have 'FIREuni' : 'FALSE'.
my object for which I want to set the value of FIREuni based upon cookie presence:
<script type="text/javascript">
var TrackObject = {
'UNI' : {
'CID': '123678',
'TYPE': '7654',
'OID': '{{ ORDERNUMBER }}',
'CURRENCY': 'USD',
'DISCOUNT': '',
'COUPON': '',
'FIRECJ' : 'TRUE',
PRODUCTLIST : [
{ 'ITEM': '{{ sku }}',
'AMT': '{{ UnitPrice }}',
'QTY': '{{ ORDERQUANTITY }}'
}
]
}};
</script>
My Question is how do I change the value based upon the presence of src='uni', can somebody guide me towards a potential solution?
Aucun commentaire:
Enregistrer un commentaire