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: [], };