Skip to content

Commit

Permalink
Merge pull request #7076 from guardian/as/remove-cmp-ga
Browse files Browse the repository at this point in the history
  • Loading branch information
sndrs authored Jan 31, 2023
2 parents fed50bc + 297be22 commit 3f662e5
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions dotcom-rendering/src/web/browser/bootCmp/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,6 @@ import { injectPrivacySettingsLink } from '../../lib/injectPrivacySettingsLink';
import { submitComponentEvent } from '../ophan/ophan';
import { startup } from '../startup';

const trackPerformance = (
timingCategory: string,
timingVar: any,
timingLabel: string,
): void => {
const { ga } = window;

if (!ga) {
return;
}

// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- not supported in all browsers
if (window.performance?.now) {
ga(
'allEditorialPropertyTracker.send',
'timing',
timingCategory,
timingVar,
Math.round(window.performance.now()),
timingLabel,
);
}
};

const init = async (): Promise<void> => {
/**
* Keep this file in sync with CONSENT_TIMING in static/src/javascripts/boot.js in frontend
Expand All @@ -44,19 +20,6 @@ const init = async (): Promise<void> => {
const browserId = getCookie({ name: 'bwid', shouldMemoize: true });
const { pageViewId } = window.guardian.config.ophan;

// Track when CMP will show with GA
cmp.willShowPrivacyMessage()
.then((willShow) => {
trackPerformance(
'consent',
'acquired',
willShow ? 'new' : 'existing',
);
})
.catch((e) =>
log('dotcom', `CMP willShowPrivacyMessage - error: ${String(e)}`),
);

onConsentChange((consentState: ConsentState) => {
if (!consentState) return;
// Register changes in consent state with Ophan
Expand Down

0 comments on commit 3f662e5

Please sign in to comment.