From df13e8cff342da7db5d87dad6f1539708d4152f3 Mon Sep 17 00:00:00 2001 From: Ravi <7014230+arelra@users.noreply.github.com> Date: Thu, 17 Oct 2024 10:49:45 +0100 Subject: [PATCH] Respect permutive switch for `prepare-permutive` (#1629) * Respect permutive switch for prepare-permutive * Changeset --- .changeset/angry-boats-relax.md | 5 +++++ src/init/consented/prepare-permutive.ts | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/angry-boats-relax.md diff --git a/.changeset/angry-boats-relax.md b/.changeset/angry-boats-relax.md new file mode 100644 index 000000000..a6cad8423 --- /dev/null +++ b/.changeset/angry-boats-relax.md @@ -0,0 +1,5 @@ +--- +'@guardian/commercial': minor +--- + +Respect permutive switch for prepare-permutive diff --git a/src/init/consented/prepare-permutive.ts b/src/init/consented/prepare-permutive.ts index e57f78695..93c118270 100644 --- a/src/init/consented/prepare-permutive.ts +++ b/src/init/consented/prepare-permutive.ts @@ -165,7 +165,7 @@ const runPermutive = ( * https://permutive.com/audience-platform/publishers/ * @returns Promise */ -export const initPermutive = (): Promise => { +const initPermutiveSegmentation = () => { /* eslint-disable -- permutive code */ // From here until we re-enable eslint is the Permutive code // that we received from them. @@ -237,7 +237,12 @@ export const initPermutive = (): Promise => { ophan: window.guardian.config.ophan, }; runPermutive(permutiveConfig, window.permutive); +}; +export const initPermutive = () => { + if (window.guardian.config.switches.permutive) { + void initPermutiveSegmentation(); + } return Promise.resolve(); };