Add a posthog_cookies setting to decide which persistence value to set if consent is not given

Created on 12 February 2025, 3 months ago

Problem/Motivation

Based on 🐛 With posthog_cookies enabled there's no session, all visits are new Active It would be nice if the site owner could decide which persistence value should be set if consent is denied, instead of hard-coding "memory": https://posthog.com/docs/libraries/js#persistence
Still "memory" should be the default and the suggested option. Link the docs.

If you want to change how PostHog stores this information, you can do so with the persistence configuration option:

  • persistence: "localStorage+cookie" (default): Limited things are stored in the cookie such as the distinctID and the sessionID, and everything else in the browser's localStorage.
  • persistence: "cookie" : Stores all data in a cookie.
  • persistence: "localStorage": Stores everything in localStorage.
  • persistence: "sessionStorage": Stores everything in sessionStorage.
  • persistence: "memory": Stores everything in page memory, which means data is only persisted for the duration of the page view.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

1.0

Component

Code (posthog_cookies)

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024