@codecademy/tracking 1.0.22 → 1.0.23-alpha.3bacebe8dc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export function setGoogleConsentDefaults(_ref) {
|
|
2
|
+
var _scope$dataLayer;
|
|
3
|
+
let scope = _ref.scope,
|
|
4
|
+
optedOutExternalTracking = _ref.optedOutExternalTracking;
|
|
5
|
+
(_scope$dataLayer = scope.dataLayer) !== null && _scope$dataLayer !== void 0 ? _scope$dataLayer : scope.dataLayer = [];
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
|
+
function gtag() {
|
|
9
|
+
var _scope$dataLayer2;
|
|
10
|
+
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11
|
+
_args[_key] = arguments[_key];
|
|
12
|
+
}
|
|
13
|
+
(_scope$dataLayer2 = scope.dataLayer) === null || _scope$dataLayer2 === void 0 ? void 0 : _scope$dataLayer2.push(arguments);
|
|
14
|
+
}
|
|
15
|
+
if (optedOutExternalTracking) {
|
|
16
|
+
gtag('consent', 'default', {
|
|
17
|
+
ad_storage: 'denied',
|
|
18
|
+
analytics_storage: 'denied',
|
|
19
|
+
functionality_storage: 'denied',
|
|
20
|
+
personalization_storage: 'denied',
|
|
21
|
+
security_storage: 'granted',
|
|
22
|
+
ad_user_data: 'denied',
|
|
23
|
+
ad_personalization: 'denied',
|
|
24
|
+
wait_for_update: 500
|
|
25
|
+
});
|
|
26
|
+
} else {
|
|
27
|
+
gtag('consent', 'default', {
|
|
28
|
+
ad_storage: 'granted',
|
|
29
|
+
analytics_storage: 'granted',
|
|
30
|
+
functionality_storage: 'granted',
|
|
31
|
+
personalization_storage: 'granted',
|
|
32
|
+
security_storage: 'granted',
|
|
33
|
+
ad_user_data: 'granted',
|
|
34
|
+
ad_personalization: 'granted',
|
|
35
|
+
wait_for_update: 500
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
gtag('consent', 'default', {
|
|
39
|
+
ad_storage: 'denied',
|
|
40
|
+
analytics_storage: 'denied',
|
|
41
|
+
functionality_storage: 'denied',
|
|
42
|
+
personalization_storage: 'denied',
|
|
43
|
+
security_storage: 'granted',
|
|
44
|
+
ad_user_data: 'denied',
|
|
45
|
+
ad_personalization: 'denied',
|
|
46
|
+
wait_for_update: 500,
|
|
47
|
+
region: ['DE', 'NO', 'BE', 'FI', 'PT', 'BG', 'DK', 'LT', 'LU', 'LV', 'HR', 'FR', 'HU', 'SE', 'MC', 'SI', 'SK', 'MF', 'SM', 'GB', 'YT', 'IE', 'GF', 'EE', 'MQ', 'MT', 'GP', 'IS', 'GR', 'IT', 'ES', 'RE', 'AT', 'CY', 'CZ', 'AX', 'PL', 'RO', 'LI', 'NL']
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { conditionallyLoadAnalytics } from './conditionallyLoadAnalytics';
|
|
2
2
|
import { fetchDestinationsForWriteKey } from './fetchDestinationsForWriteKey';
|
|
3
3
|
import { getConsentDecision } from './getConsentDecision';
|
|
4
|
+
import { setGoogleConsentDefaults } from './googleConsent';
|
|
4
5
|
import { mapDestinations } from './mapDestinations';
|
|
5
6
|
import { initializeOneTrust } from './onetrust';
|
|
6
7
|
import { runSegmentSnippet } from './runSegmentSnippet';
|
|
@@ -16,6 +17,10 @@ export const initializeTrackingIntegrations = async _ref => {
|
|
|
16
17
|
writeKey = _ref.writeKey;
|
|
17
18
|
// 1. Wait 1000ms to allow any other post-hydration logic to run first
|
|
18
19
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
20
|
+
setGoogleConsentDefaults({
|
|
21
|
+
scope,
|
|
22
|
+
optedOutExternalTracking
|
|
23
|
+
});
|
|
19
24
|
|
|
20
25
|
// 2. Load in OneTrust's banner and wait for its `OptanonWrapper` callback
|
|
21
26
|
await initializeOneTrust({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/tracking",
|
|
3
3
|
"description": "Tracking library for Codecademy",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.23-alpha.3bacebe8dc.0",
|
|
5
5
|
"author": "Codecademy Engineering <dev@codecademy.com>",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist/**"
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"repository": "git@github.com:codecademy-engineering/mono.git",
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "e7dd6505b5dadeb9fa1be3a4dc73a4b8fcc0ac98"
|
|
17
17
|
}
|