From 38b2a5c72695e604c40ab9fbafaf77a412e2ca00 Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Wed, 23 Aug 2023 23:39:42 -0500 Subject: [PATCH] wip --- .../consent-wrapper-onetrust/README.md | 37 +++++++++++-------- .../src/standalone/index.ts | 28 +------------- 2 files changed, 23 insertions(+), 42 deletions(-) diff --git a/packages/consent/consent-wrapper-onetrust/README.md b/packages/consent/consent-wrapper-onetrust/README.md index 93b4d276a..44a00a601 100644 --- a/packages/consent/consent-wrapper-onetrust/README.md +++ b/packages/consent/consent-wrapper-onetrust/README.md @@ -50,21 +50,28 @@ withOneTrust(analytics).load({ writeKey: ' }) ``` -## For snippet users (window.analytics) who _also_ use a bundler like webpack +## For snippet users (window.analytics) -### _NOTE:_ a pre-bundled version that can be loaded through a ` + + + + + + + ``` -- Use the following initialization code - -```ts -import { withOneTrust } from '@segment/analytics-consent-wrapper-onetrust' - -withOneTrust(window.analytics).load('') -``` +#### Reminder: _delete_ `analytics.load('....')` from the original Segment snippet so that only .load() is only called after `withOneTrust` is called. See comment in example above. diff --git a/packages/consent/consent-wrapper-onetrust/src/standalone/index.ts b/packages/consent/consent-wrapper-onetrust/src/standalone/index.ts index 2c86999ae..9d9260b4c 100644 --- a/packages/consent/consent-wrapper-onetrust/src/standalone/index.ts +++ b/packages/consent/consent-wrapper-onetrust/src/standalone/index.ts @@ -1,28 +1,2 @@ import { withOneTrust } from '../index' - -/** - * usage: - * ```html - * - * - * - * - * - * - * - * - * - * ``` - */ - -// If we ever need to support an analytics instance that is renamed something else, we can add support for a custom attribute to the script tag. -if ((window as any).analytics) { - withOneTrust((window as any).analytics) -} else { - console.error( - 'Will not load OneTrust wrapper. window.analytics is not defined' - ) -} +;(window as any).withOneTrust = withOneTrust