Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update browser-plugin-ga-cookies to include options for Google Analytics 4 cookies #1226

Merged

Conversation

igneel64
Copy link
Contributor

@igneel64 igneel64 commented Aug 8, 2023

This update allows for the browser-plugin-ga-cookies to collect Google Analytics 4 cookie values.

Up to now the plugin did not accept any options and only collected a standard set of values for the schema iglu:com.google.analytics/cookies/jsonschema/1-0-0.

This PR adds the capability for the plugin to collect Google Analytics 4 cookies without breaking the previous implementation. With the options, you can specifiy which set of cookies you want to collect and since the GA4 session cookie name is based on a parameter called container-id, the client should input this as well to collect the correct value.

E.g.

GaCookiesPlugin(); /* Current behaviour collecting only UA cookie values. */

GaCookiesPlugin({ ga4: true, measurementId: 'G-test' }); /* Collects UA and GA4 cookie values. */

GaCookiesPlugin({ ua: false, ga4: true, measurementId: 'G-test' }); /* Collects GA4 cookie values. */

After collecting the GA4 session cookie, the customer will be able to extract information such as the session id and session index from the cookie.

New schema for GA4 cookies:

In the case of cookiePrefix/es N, N number of GA4 cookie contexts will be attached.

@igneel64
Copy link
Contributor Author

igneel64 commented Aug 8, 2023

For JS tracker V4 we can change the defaults to GA4 cookies and have UA only as opt-in because it will be deprecated for all customers.

@bundlemon
Copy link

bundlemon bot commented Aug 8, 2023

BundleMon

Files added (6)
Status Path Size Limits
libraries/browser-tracker-core/dist/index.mod
ule.js
+25.19KB 26KB / +10%
trackers/javascript-tracker/dist/sp.js
+24.34KB 25KB / +10%
trackers/javascript-tracker/dist/sp.lite.js
+14.8KB 15KB / +10%
trackers/browser-tracker/dist/index.umd.min.j
s
+14.64KB 15KB / +10%
libraries/tracker-core/dist/index.module.js
+13.35KB 15KB / +10%
trackers/browser-tracker/dist/index.module.js
+3.51KB 5KB / +10%

Total files change +95.83KB 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history

@igneel64 igneel64 force-pushed the feature/1225-ga-cookies-plugin-ga4-cookies-addition branch from efcc381 to 654a1dc Compare August 14, 2023 14:18
@igneel64 igneel64 requested a review from jethron August 14, 2023 14:28
plugins/browser-plugin-ga-cookies/README.md Outdated Show resolved Hide resolved
plugins/browser-plugin-ga-cookies/README.md Outdated Show resolved Hide resolved
plugins/browser-plugin-ga-cookies/src/index.ts Outdated Show resolved Hide resolved
plugins/browser-plugin-ga-cookies/src/index.ts Outdated Show resolved Hide resolved
plugins/browser-plugin-ga-cookies/src/index.ts Outdated Show resolved Hide resolved
plugins/browser-plugin-ga-cookies/src/index.ts Outdated Show resolved Hide resolved
@igneel64 igneel64 force-pushed the feature/1225-ga-cookies-plugin-ga4-cookies-addition branch 2 times, most recently from d1e2517 to b4cd43f Compare August 15, 2023 21:25
Copy link
Contributor

@jethron jethron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@igneel64 igneel64 force-pushed the feature/1225-ga-cookies-plugin-ga4-cookies-addition branch from b4cd43f to 76e4487 Compare August 18, 2023 08:50
@igneel64 igneel64 force-pushed the feature/1225-ga-cookies-plugin-ga4-cookies-addition branch from 76e4487 to 735f4e3 Compare August 18, 2023 09:23
@igneel64 igneel64 changed the base branch from master to release/3.17.0 November 14, 2023 12:36
@igneel64 igneel64 merged commit 15f7bc0 into release/3.17.0 Nov 14, 2023
3 checks passed
@igneel64 igneel64 deleted the feature/1225-ga-cookies-plugin-ga4-cookies-addition branch November 14, 2023 12:36
@igneel64 igneel64 mentioned this pull request Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants