Posted - 02/25/2025 : 08:40:40
Howdy Vince, I've been trying to hunt down why I wasn't getting affiliate cookies referenced on customer orders. I was going to use that to help us keep track of PPC performance. Turns out, because the cookie is set in the .asp code, it wont work if the page is cached (in cloudflare for us). The workaround for this of course would be to read and write the cookie using Javascript instead. I added a little conditional addition of javascript to the footer that seemed to fix it up just fine. <% 'capture the PARTNER querystring as a cookie if it is in the URL if request.querystring("partner") <> "" then %> <script> document.cookie = "partner=<%=request.querystring("partner")%>; max-age=31536000; path=/"; </script> <% end if %>
It's worth noting that any part of the code that uses this will not work if the page isn't served from origin: sub setacookie(cname,cval,cdays) response.cookies(cname)=cval if cdays<>0 then response.cookies(cname).expires=date()+cdays if request.servervariables("HTTPS")="on" then response.cookies(cname).secure=TRUE end sub
I imagine you could make something better than what I crafted there. - Graham
|