Reputation: 183
I'm setting this cookie in Google Tag Manager but when I inspect the cookie with my Chrome plugin it's showing as expired as soon as it was set. I want it to be set for 7 days.
Clearly I'm doing something wrong. I've been looking at other examples online and I can't see what I'm missing!
<script type="text/JavaScript">document.cookie = "retailview=true;expires=7*24*60*60*1000;domain=visioncritical.com;path=/;";
</script>
Upvotes: 0
Views: 566
Reputation: 183
Someone helped me work it out. Here is the solution:
var a = new Date();
a = new Date(a.getTime() +7*24*60*60*1000);
document.cookie = "retailview=true;expires="+a.toGMTString()+";domain=visioncritical.com;path=/";
Upvotes: 1