I have enabled cookies in every way that I can find in the browsers settings but with the debug = true flag enabled I am seeing the following in console
Initializing Google Analytics.
analytics_debug.js:25 Running command: ga("create", "UA-xxxxxxxxxxx, "auto")
analytics_debug.js:25 Creating new tracker: t0
analytics_debug.js:25 New visitor. Generating new clientId
analytics_debug.js:25 Generating new gid
analytics_debug.js:25 Cookie write failed.
analytics_debug.js:25 Cookie write failed.
analytics_debug.js:25 Running command: ga("send", {hitType: "pageview", page: "/page"})
analytics_debug.js:25 Cookie write failed.
analytics_debug.js:25 Cookie write failed.
analytics_debug.js:25 Storage not available. Aborting hit
This is leading to no analytics data being sent up to GA. I have tested using both localhost and our deployed website. The problem seems specific to chrome as it's not happening in firefox or safari. I tried updating to the latest version of react-ga 3.1.2 but the issue persists.
Additional info: it could be related to running the app inside an iframe. Chrome version: Version 86.0.4240.75 (Official Build) (x86_64) Mac-OS
This WAS working previously and has suddenly stopped working within the last few weeks.
I did find a work-around for this issue if anyone else has the same problem: You must manually call the ga() method with { cookieFlags: "SameSite=None; Secure" }
ReactGA.initialize(trackingId, { useExistingGa: true });
ga("create", trackingId, 'auto', { cookieFlags: "SameSite=None; Secure" });
This bug was causing me to not track sessions. Fix worked 馃殌
Great fix, Thanks @amcinerneynewf
Most helpful comment
I did find a work-around for this issue if anyone else has the same problem: You must manually call the ga() method with
{ cookieFlags: "SameSite=None; Secure" }