Skip to content

Instantly share code, notes, and snippets.

@KeithP
Created April 6, 2018 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KeithP/44b7ac4555f18f6a767788243071fb35 to your computer and use it in GitHub Desktop.
Save KeithP/44b7ac4555f18f6a767788243071fb35 to your computer and use it in GitHub Desktop.
How to initialise https://cookieconsent.insites.com with "Disabling cookies" code
window.App ||= {}
App.init = ->
window.cookieconsent.initialise
"palette":
"popup":
"background": "#252e39"
,
"button":
"background": "#14a7d0"
,
"theme": "classic",
"type": "opt-out",
onInitialise: (status) ->
type = this.options.type
consented = this.hasConsented()
if type == 'opt-out' && !consented
# disable cookies
App.disableCookies()
,
onStatusChange: (status, chosenBefore) ->
type = this.options.type
consented = this.hasConsented()
if consented
# ensable cookies
App.enableCookies()
if !consented
# disable cookies
App.disableCookies()
,
onRevokeChoice: () ->
# disable cookies
App.disableCookies()
,
"content":
"dismiss": "Accept cookies",
"message": "This website uses cookies to ensure you get the best experience on our website.",
"link": " Cookies Policy",
"href": "/cookies-policy"
$(document).on "turbolinks:load", ->
App.init()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment