@codecademy/tracking 1.0.22-alpha.17071bf7be.0 → 1.0.22-alpha.7ff2959d48.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
|
+
}
|
|
@@ -4,6 +4,7 @@ import { getConsentDecision } from './getConsentDecision';
|
|
|
4
4
|
import { mapDestinations } from './mapDestinations';
|
|
5
5
|
import { initializeOneTrust } from './onetrust';
|
|
6
6
|
import { runSegmentSnippet } from './runSegmentSnippet';
|
|
7
|
+
import { setGoogleConsentDefaults } from './googleConsent';
|
|
7
8
|
/**
|
|
8
9
|
* @see README.md for details and usage.
|
|
9
10
|
*/
|
|
@@ -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({
|
|
@@ -25,4 +25,4 @@ export const initializeOneTrust = async _ref => {
|
|
|
25
25
|
|
|
26
26
|
// For now, these three values duplicate theme colors from gamut-styles
|
|
27
27
|
// We don't want to take a full dependency on that package here...
|
|
28
|
-
const rawStyles = "\n:root {\n --onetrust-brand-purple: #3A10E5;\n --onetrust-color-gray-500: #828285;\n --onetrust-color-white: #fff;\n}\n\n#onetrust-banner-sdk {\n padding: 1rem !important;\n}\n#onetrust-banner-sdk > .ot-sdk-container {\n width: 100% !important;\n}\n#onetrust-banner-sdk > .ot-sdk-container > .ot-sdk-row {\n display: flex !important;\n flex-direction: column !important;\n align-items: center !important;\n max-width: 1436px !important;\n margin: 0 auto !important;\n}\n#onetrust-banner-sdk > .ot-sdk-container > .ot-sdk-row:after {\n content: none !important;\n}\n#onetrust-
|
|
28
|
+
const rawStyles = "\n:root {\n --onetrust-brand-purple: #3A10E5;\n --onetrust-color-gray-500: #828285;\n --onetrust-color-white: #fff;\n}\n\n#onetrust-banner-sdk {\n padding: 1rem !important;\n}\n#onetrust-banner-sdk > .ot-sdk-container {\n width: 100% !important;\n}\n#onetrust-banner-sdk > .ot-sdk-container > .ot-sdk-row {\n display: flex !important;\n flex-direction: column !important;\n align-items: center !important;\n max-width: 1436px !important;\n margin: 0 auto !important;\n}\n#onetrust-banner-sdk > .ot-sdk-container > .ot-sdk-row:after {\n content: none !important;\n}\n#onetrust-group-container {\n display: flex !important;\n justify-content: center;\n float: none !important;\n width: 100% !important;\n max-width: 1148px !important;\n margin-left: 0 !important;\n margin-bottom: 0.625rem !important;\n}\n#onetrust-policy,\n#onetrust-policy-text {\n margin: 0 !important;\n font-size: 0.875rem !important;\n line-height: 1.375rem !important;\n text-align: center !important;\n float: none !important;\n}\n#onetrust-policy-text a {\n text-decoration: none;\n line-height: 26px !important;\n margin-left: 0 !important;\n}\n#onetrust-button-group-parent {\n position: relative !important;\n top: initial !important;\n left: initial !important;\n transform: initial !important;\n width: 264px !important;\n margin: 0 !important;\n padding: 0 !important;\n float: none !important;\n}\n#onetrust-button-group {\n display: flex !important;\n margin: 0 !important;\n}\n#onetrust-pc-btn-handler, #onetrust-accept-btn-handler {\n min-width: initial !important;\n padding: 0.375rem 1rem !important;\n margin: 0 !important;\n opacity: 1 !important;\n border-radius: 2px !important;\n line-height: 1.5 !important;\n user-select: none !important;\n font-size: 1rem !important;\n}\n#onetrust-pc-btn-handler:focus, #onetrust-accept-btn-handler:focus {\n box-shadow: 0 0 0 2px var(--onetrust-color-white), 0 0 0 4px var(--onetrust-brand-purple);\n text-decoration: none !important;\n outline: none !important;\n}\n#onetrust-pc-btn-handler{\n color: var(--onetrust-brand-purple) !important;\n border: 1px solid var(--onetrust-brand-purple)!important;\n background: var(--onetrust-color-white) !important\n}\n#onetrust-accept-btn-handler {\n color: var(--onetrust-color-white) !important;\n background: var(--onetrust-brand-purple)!important;\n margin-left: 1rem !important;\n}\n#onetrust-close-btn-container {\n display: none !important;\n}\n\n.pc-logo {\n display: none !important;\n}\n\n#accept-recommended-btn-handler,\n.ot-pc-refuse-all-handler,\n.save-preference-btn-handler {\n margin-left: 4px !important;\n font-size: 14px !important;\n}\n\n#accept-recommended-btn-handler:focus,\n#onetrust-pc-sdk .ot-pc-refuse-all-handler:focus,\n#onetrust-pc-sdk .save-preference-btn-handler:focus {\n box-shadow: 0 0 0 2px var(--onetrust-color-white), 0 0 0 4px var(--onetrust-brand-purple);\n text-decoration: none !important;\n outline: none !important;\n opacity: 1 !important;\n}\n\n.ot-switch-label {\n border: 1px solid var(--onetrust-color-gray-500) !important;\n background-color: var(--onetrust-color-gray-500) !important;\n}\n\n.ot-switch-nob {\n background: var(--onetrust-color-white) !important;\n}\n\n.ot-switch-inner:before {\n background-color: var(--onetrust-brand-purple) !important;\n}\n\n.switch-checkbox:checked+.ot-switch-label .ot-switch-nob {\n border-color: var(--onetrust-brand-purple) !important;\n}\n\n.ot-pc-footer-logo {\n display: none !important;\n}\n\n#onetrust-banner-sdk>.ot-sdk-container {\n overflow: visible !important;\n}\n\n@media (max-width: 30rem) {\n #accept-recommended-btn-handler,\n .ot-pc-refuse-all-handler,\n .save-preference-btn-handler {\n width: 96% !important;\n }\n}\n\n@media (min-width: 37.5rem) {\n #onetrust-banner-sdk {\n padding: 0.875rem 1rem !important;\n }\n}\n@media (min-width: 48rem) {\n #onetrust-banner-sdk {\n padding: 0.875rem 1.25rem !important;\n }\n}\n@media (min-width: 1650px) {\n #onetrust-banner-sdk > .ot-sdk-container > .ot-sdk-row {\n flex-direction: row !important;\n justify-content: space-between !important;\n }\n #onetrust-group-container {\n margin-bottom: 0 !important;\n }\n #onetrust-button-group {\n flex-direction: row !important;\n }\n}\n";
|
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.22-alpha.
|
|
4
|
+
"version": "1.0.22-alpha.7ff2959d48.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": "cf475ba05592ff90c4f16a4c83f0a13b9ff49b8b"
|
|
17
17
|
}
|