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

Fix conflict between window.analytics AND npm library in same scope. #1127

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

silesky
Copy link
Contributor

@silesky silesky commented Aug 16, 2024

This partly addresses: #785, so we don't read buffered window.analytics events in the npm version.

Now we support using both a snippet version of analytics and a separate npm version of analytics instance (different writeKeys) in the same scope, and they shouldn't clobber eachother.

No need for globalAnalyticsKey: 'SEG_DISABLE' workaround.

For posterity, there is an existing gap is around if a user needs to override the global cdn on a specific instance.

This drops support for the implicit behavior described in #390

Copy link

changeset-bot bot commented Aug 16, 2024

🦋 Changeset detected

Latest commit: 7275822

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

This PR includes changesets to release 1 package
Name Type
@segment/analytics-next 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 changed the title do not hydrate from window in npm version Do not hydrate from window object in npm version -- allow for both window.analytics AND npm version in same page. Aug 16, 2024
@silesky silesky changed the title Do not hydrate from window object in npm version -- allow for both window.analytics AND npm version in same page. Do not hydrate from window object in npm version -- allow for both window.analytics AND npm library in same scope. Aug 16, 2024
@silesky silesky changed the title Do not hydrate from window object in npm version -- allow for both window.analytics AND npm library in same scope. Fix conflict between window.analytics AND npm library in same scope. Aug 16, 2024
@silesky silesky requested a review from danieljackins August 16, 2024 20:42
@silesky silesky merged commit 6bfaa3e into master Aug 19, 2024
5 checks passed
@silesky silesky deleted the do-not-hydrate-from-window-in-npm-version branch August 19, 2024 16:14
@github-actions github-actions bot mentioned this pull request Aug 19, 2024
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