Site has two sections; 'Everywhere' and 'LA'.
Default is 'Everywhere' section.
How would I go about creating a cookie if the visitor clicks the 'LA' section link and when they return to the main site on another visit, they are redirected to that 'LA' section?
I've tried altering this script; http://www.javascriptsource.com/cookies/cookie-redirect.html
Instead of checkboxes, its a link and only one. But doesn't seem to work.
What I do usually is create a conditional, and create an embed with the cookie inside. I also tend to use this add-on: http://devot-ee.com/add-ons/cookies
Tad,
For setting the cookie you are going to want to use javascript, using a click handler on the LA section link. If you need some help with setting the cookie in javascript there is a good introductory article at http://www.quirksmode.org/js/cookies.html which isn't bang up to date but is still in full working order.
Once the cookie is set then you will switch to using one of the plugins for EE so that you can check for the existence of it in a template (probably in the an embeded or snippeted template) on page load. If you find the cookie then you can use the standard EE redirect syntax to send the visitor to the relevant section.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With