Guest User

Untitled

a guest
Oct 19th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. import bootstrap.liftmodules.GoogleAnalytics
  2. import GoogleAnalytics.dsl._
  3.  
  4. // Always track
  5. GoogleAnalytics.init
  6.  
  7. // Provide a one-time banner, based on the absence of a cookie:
  8. GoogleAnalytics.alertUser( only when( S.cookieValue("ckns_policy").isEmpty ) {
  9. import net.liftweb.http.js._
  10. import JE._
  11. import JsCmds._
  12. import net.liftweb.http.provider.HTTPCookie
  13.  
  14. // Set the cookie to prevent showing this page again:
  15. val oneYear = 365 * 24 * 60 * 60
  16. S.addCookie( HTTPCookie("ckns_policy", "1").setPath("/").setMaxAge(oneYear) )
  17.  
  18. // Add a div to the top of the page with some information in it:
  19. JsRaw("$('body').prepend('<div id=notice></div>')") &
  20. SetHtml("notice", <div>
  21. <div id="title">Cookies on our website</div>
  22. <div id="info">We use cookies to ensure that we give you the best experience on our website.
  23. If you continue without changing your settings, we'll assume that you are
  24. happy to receive all cookies on the our website.
  25. <a href="/cookies.html">Find out more</a> about our cookie policies. </div>
  26. </div>)
  27.  
  28. }
Add Comment
Please, Sign In to add comment