3

Having some issues with setting a cookie to expire on window close

Keen provide some good utilities such as Keen.utils.cookie('sessioncookie')

However I'm still struggling. If anyone could point me in the right direction I would appreciate it.

Isaac Martin
  • 79
  • 1
  • 5
  • Thanks for confirming, will update the question to reflect. I have set the cookie - more about destroying it on window close. – Isaac Martin Jun 27 '17 at 17:55
  • Possible duplicate of [delete cookie when browser closed](https://stackoverflow.com/questions/13872305/delete-cookie-when-browser-closed) – gforce301 Jun 27 '17 at 17:57

1 Answers1

1

The Keen IO keen-js library and keen-tracking JavaScript library uses js-cookie under the hood. js-cookie is a simple, lightweight JavaScript API for handling browser cookies.

The js-cookie library will remove cookies by default when the browser is closed, unless an expiration value is set. This shows where to set that here: https://github.com/js-cookie/js-cookie/blob/master/README.md#expires

jandwiches
  • 487
  • 3
  • 7