Feature: Enhance Tracking by Storing gclid, fbclid, and UTM Parameters in Cookies and Preventing Non-Search Key Capture
Current Behavior
- Cookie Capture: Currently, Jitsu captures the __fbc, __fbp, and __ga cookies and places them under “clientIds” in the JSON event data. However, gclid and fbclid are not captured.
- UTM Data: UTM data is captured from URL parameters but does not persist after navigating to another page.
Suggested Improvement
1.Storing gclid and fbclid: Store gclid and fbclid in cookies, allowing them to be overwritten if new values are present. Currently, they are only URL parameters and are not stored as cookies in the browser. Jitsu should capture gclid and fbclid from cookies and save them under “clientIds” in the JSON event data.
2.Persisting UTM Data: Capture UTM data from the URL and store it in cookies. Jitsu should read UTM data from these cookies.
3.Preventing Non-Search Key Capture: For WordPress sites, ensure that non-search keys are not captured as search keys. Specifically, the ?s parameter key should be handled correctly.
Reasons for Improvements
- Enhanced Audience Matching and Performance Tracking: Storing gclid and fbclid in cookies will improve Google and Facebook audience matching and performance tracking.
- Ad Blocker Circumvention: When ad blockers are enabled, the __fbc, __fbp, and __ga cookies are not generated because Google and Facebook tracking scripts are blocked. However, gclid and fbclid can still be captured from URL parameters, ensuring data is still collected.
We probably won't store utm_* parameters in cookie. We generally consider polluting cookies as a bad idea, especially considering the fact that cookies are becoming less reliable.
You could always persist utm's by anonymousId key in the store
Speaking of gclid / fbclid. Here's a design we think makes sense here:
- Introduce
clickIdsnode and populate it with most popular click ids:gclidandfbclid - Introduce two parameters for JS client:
clickIdsCaptureandcookieCaptureto let user control what additional cookies / parameters to capture