Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bootstrap.liftmodules.GoogleAnalytics
- import GoogleAnalytics.dsl._
- // Always track
- GoogleAnalytics.init
- // Provide a one-time banner, based on the absence of a cookie:
- GoogleAnalytics.alertUser( only when( S.cookieValue("ckns_policy").isEmpty ) {
- import net.liftweb.http.js._
- import JE._
- import JsCmds._
- import net.liftweb.http.provider.HTTPCookie
- // Set the cookie to prevent showing this page again:
- val oneYear = 365 * 24 * 60 * 60
- S.addCookie( HTTPCookie("ckns_policy", "1").setPath("/").setMaxAge(oneYear) )
- // Add a div to the top of the page with some information in it:
- JsRaw("$('body').prepend('<div id=notice></div>')") &
- SetHtml("notice", <div>
- <div id="title">Cookies on our website</div>
- <div id="info">We use cookies to ensure that we give you the best experience on our website.
- If you continue without changing your settings, we'll assume that you are
- happy to receive all cookies on the our website.
- <a href="/cookies.html">Find out more</a> about our cookie policies. </div>
- </div>)
- }
Add Comment
Please, Sign In to add comment