Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consent: add bundled version that can be loaded via script tag #938

Merged
merged 1 commit into from
Aug 28, 2023

Conversation

silesky
Copy link
Contributor

@silesky silesky commented Aug 24, 2023

This PR creates bundled versions of analytics-consent-wrapper-onetrust:
image

For more info, see the README Updates: https://github.com/segmentio/analytics-next/blob/consent-add-umd-script-build/packages/consent/consent-wrapper-onetrust/README.md#for-snippet-users-windowanalytics

  1. Rename oneTrust -> withOneTrust
  2. Allow chaining - this makes it easier from a docs / ergonomic perspective
  3. Add a umd version that also assigns a window.withOneTrust object. (In my research, I found that some libs like Chart.js did this, so I felt like this was an idiomatic approach).
    Other benefits:
    • simple / idiomatic (only one bundle to worry about supporting / uploading to CDN)
    • supports UMD users and script users, so lessons support burden
    • having a "umd" folder is what we already do with browser , and it even is something that unpkg expects implicitly

@changeset-bot
Copy link

changeset-bot bot commented Aug 24, 2023

🦋 Changeset detected

Latest commit: 258ef51

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@segment/analytics-consent-wrapper-onetrust Minor
@segment/analytics-consent-tools Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@silesky silesky marked this pull request as draft August 24, 2023 04:31
@silesky silesky force-pushed the consent-add-umd-script-build branch from 8ed1373 to d2c8b73 Compare August 24, 2023 21:53
@silesky silesky marked this pull request as ready for review August 24, 2023 21:53
@silesky silesky changed the title consent add umd script build Consent: add bundled version that can be loaded via script tag Aug 24, 2023
@silesky silesky force-pushed the consent-add-umd-script-build branch from 3651257 to 30168c0 Compare August 25, 2023 21:15
@silesky silesky force-pushed the consent-add-umd-script-build branch from ddf71d7 to 258ef51 Compare August 28, 2023 19:56
Copy link
Contributor

@oscb oscb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

```

- Use the following initialization code
#### ⚠️ 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this is great to callout things, I'm going to borrow this for an RN readme change

@silesky silesky merged commit 2191eb3 into master Aug 28, 2023
3 checks passed
@silesky silesky deleted the consent-add-umd-script-build branch August 28, 2023 21:17
@github-actions github-actions bot mentioned this pull request Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants