posthog-js icon indicating copy to clipboard operation
posthog-js copied to clipboard

Cookies not being set

Open tomelliot opened this issue 1 year ago • 1 comments

Hi there,

I'm running a Next.js 13 app. I followed the guide here on setting up posthog-js for the front end.

I'm not seeing any cookies being set, so users are given a new ID on every new visit. I've tried Firefox + Chrome. Setting persistence: cookie doesn't help. Setting persistence:localStorage+cookie does help, but the only storage that's used is local storage (there's still no cookie stored). I'm seeing cookies for other services being stored fine.

With debug:true I'm not seeing any info that helps me debug (just events being sent out).

Any ideas what might be happening here? Is there a way to instrument the storage handler so I can see what it's doing?

tomelliot avatar Oct 22 '23 13:10 tomelliot

Can definitely confirm this bug. There is something wrong with the way the cookies get stored. Setting persistence:localStorage+cookie fixes the issue.

AndreaPontrandolfo avatar Oct 31 '23 14:10 AndreaPontrandolfo