From 3deba30b9ddbcb31550b2602ca808b36e48350b7 Mon Sep 17 00:00:00 2001 From: Jethro Nederhof Date: Fri, 4 Oct 2024 13:28:52 +1000 Subject: [PATCH] Switch to GA4 as default for gaCookies plugin --- ...acookies-switch-default_2024-10-04-03-42.json | 10 ++++++++++ plugins/browser-plugin-ga-cookies/README.md | 16 ++++++++-------- plugins/browser-plugin-ga-cookies/src/index.ts | 4 ++-- 3 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 common/changes/@snowplow/browser-plugin-ga-cookies/gacookies-switch-default_2024-10-04-03-42.json diff --git a/common/changes/@snowplow/browser-plugin-ga-cookies/gacookies-switch-default_2024-10-04-03-42.json b/common/changes/@snowplow/browser-plugin-ga-cookies/gacookies-switch-default_2024-10-04-03-42.json new file mode 100644 index 000000000..87d2480b2 --- /dev/null +++ b/common/changes/@snowplow/browser-plugin-ga-cookies/gacookies-switch-default_2024-10-04-03-42.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@snowplow/browser-plugin-ga-cookies", + "comment": "Change default from UA to GA4", + "type": "none" + } + ], + "packageName": "@snowplow/browser-plugin-ga-cookies" +} \ No newline at end of file diff --git a/plugins/browser-plugin-ga-cookies/README.md b/plugins/browser-plugin-ga-cookies/README.md index 0d8775d62..05bd088f2 100644 --- a/plugins/browser-plugin-ga-cookies/README.md +++ b/plugins/browser-plugin-ga-cookies/README.md @@ -5,17 +5,17 @@ Browser Plugin to be used with `@snowplow/browser-tracker`. -Adds Universal Analytics and Google Analytics 4 cookies to your Snowplow tracking. +Adds Google Analytics 4 and optionally Universal Analytics cookies to your Snowplow tracking. ## Maintainer quick start -Part of the Snowplow JavaScript Tracker monorepo. -Build with [Node.js](https://nodejs.org/en/) (14 or 16) and [Rush](https://rushjs.io/). +Part of the Snowplow JavaScript Tracker monorepo. +Build with [Node.js](https://nodejs.org/en/) (18+) and [Rush](https://rushjs.io/). ### Setup repository ```bash -npm install -g @microsoft/rush +npm install -g @microsoft/rush git clone https://github.com/snowplow/snowplow-javascript-tracker.git rush update ``` @@ -40,14 +40,14 @@ newTracker('sp1', '{{collector}}', { plugins: [ GaCookiesPlugin( /* pluginOptions */ ) ] }); -/* +/* * Available plugin options `GACookiesPluginOptions`: * { - * ua: Send Universal Analytics specific cookie values. Defaults to true. - * ga4: Send Google Analytics 4 specific cookie values. Defaults to false. + * ua: Send Universal Analytics specific cookie values. Defaults to false. + * ga4: Send Google Analytics 4 specific cookie values. Defaults to true. * ga4MeasurementId: Measurement id/ids to search the Google Analytics 4 session cookie. Can be a single measurement id as a string or an array of measurement id strings. The cookie has the form of _ga_ where is the data stream container id and is the optional cookie_prefix option of the gtag.js tracker. * cookiePrefix: Cookie prefix set on the Google Analytics 4 cookies using the cookie_prefix option of the gtag.js tracker. - * } + * } */ ``` diff --git a/plugins/browser-plugin-ga-cookies/src/index.ts b/plugins/browser-plugin-ga-cookies/src/index.ts index bd7a78ed3..c44597148 100644 --- a/plugins/browser-plugin-ga-cookies/src/index.ts +++ b/plugins/browser-plugin-ga-cookies/src/index.ts @@ -11,8 +11,8 @@ interface GACookiesPluginOptions { } const defaultPluginOptions: GACookiesPluginOptions = { - ua: true, - ga4: false, + ua: false, + ga4: true, ga4MeasurementId: '', cookiePrefix: [], };