The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Populating Custom Field from a Cookie

BillDABillDA Member
in Help edited November 2010
Hey guys, need a little help here. I'm trying to track what ad campaigns people came from by setting cookies when they arrive on my site. I want to capture this information with each order so I can see which campaigns are converting. Setting the cookies are no problem, but I need to know how to retrieve them with FoxyCart and store them. I'm assuming the best way to do this is with a custom field that gest populated from the cookie using PHP.

My site is at - what's the best way to do this? I could use a hidden custom form field on that page that gets passed into the checkout (checkout=true), or is there a way to read the cookie during the checkout process and stick it into a hidden field that will end up in my XML?

Thanks for the advice,
  • Just wanted to post and say I figured this out. Initially had some trouble because I couldn't access or set the cookie cross domain (set on and tried to read on I ended up just reading it in with PHP as a hidden ("h:") custom field on my own domain, that I then pass to FoxyCart in my form.

  • brettbrett FoxyCart Team
    Hi Bill. Glad you got it figured out, and that's definitely the recommended solution as well. Set it with an h: (can even set it automatically in the background via JSONP if you need), then pull it from the JSON on the cart and you're all ready to go.
Sign In or Register to comment.