-
Notifications
You must be signed in to change notification settings - Fork 2
Configuration Walkthrough
This walkthrough will help you determine the optimal CookieAlert configuration to match your needs.
To use this guide, you should have the CookieAlert configuration file config/initializers/cookie_alert.rb open so you can make the recommended changes as you read each step below:
Decide what you want the cookie name to be. We recommend starting the name with an underscore and including some aspect of your domain name. The default is '_we_use_cookies' but at KatanaCode.com we use the name '_KatanaCode.com_cookie_notice' to make it very clear who it's from and what it's for.
config.cookie_name = "<_your_new_name>"
Once the visitor to your website has accepted the cookie alert, or it has been displayed the requisite number of times, how long do you want to wait before displaying alerts again? You can choose from a session cookie, a fixed_duration cookie or a permanent cookie.
A session cookie means that once the visitor has accepted the alert, it will not display again while they are on your website. However, once they close their browser the session cookie will become invalid and the next time they visit the cookie alert will be displayed again.
A fixed duration cookie will last longer than a session cookie and you choose the number of days it should last. For example, a fixed duration cookie of 60 days means that once the visitor has accepted the cookie alert it will not be displayed again until 60 days have passed.
A permanent cookie means that once the visitor has accepted the cookie alert it will not be displayed again - ever!
Note: The visitor can delete cookies at any time, in which case the cookie alert will be displayed again.
# Use a session cookie
config.cookie_type = 'session'
# Use a fixed_duration cookie
config.cookie_type = 'fixed_duration'
# and
num_days_until_cookie_expires = <your chosen number of days>
# Use a permanent cookie
config.cookie_type = 'permanent'
The cookie alert message can either stay on the screen until your visitor clicks a link to acknowledge it or it can disappear after being displayed a few times.
# If you want the message to stay on screen until acknowledged set
user_must_accept_cookie_use = true
then Go to Step 4.
# If you want the message to disappear after displaying a few times set
user_must_accept_cookie_use = false
then Go to Step 6.
###Step 4
The cookie alert can change from a large (primary alert) to display a more subtle (secondary alert) after being displayed a few times.
# If you want the Primary Alert to change to the Secondary Alert set
config.use_secondary_alert = true
Go to Step 5.
# If you want the Primary Alert be the only message displayed set
config.use_secondary_alert = false
Go to Step Complete.
How many times should the primary alert be displayed before changing to the secondary alert?
max_alert_display_count = <your chosen number of displays>
Go to Step Complete
###Step 6
How many times should the Primary Alert be displayed before it is removed completely?
max_alert_display_count = <your chosen number of displays>
Go to Step Complete
###Complete
Your configurtion is now complete. Save the config file and restart your application for he changes to take effect.
There are additional advanced configuration settings available in the config/initializers/cookie_alert.rb file for advanced costomisation.