Cannot use multiple Segment integrations on the same website

Open
#785 8 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
typescript
Domain
analytics

Research direction

Start by reviewing how Analytics Next attaches to window.analytics and compare the requested behavior with Segment's deprecated v1 no-conflict option. Define how multiple integrations and other libraries can coexist without self-hosting, then add coverage for the selected behavior. Done means separate Segment integrations can operate on one page without conflicting through the global name.

Written by the indexing model from the issue text.

Description

We use no-code tools, which already use Segment for their own purposes.

Because of that, we are stuck and can't use Segment for our own purposes, because the script attaches things to window.analytics and it is not possible to have multiple Segment integrations within the same page.

We really need a way to work around this.

Also, other libraries use window.analytics and they're therefore completely incompatible with Segment.
I believe it is possible to kill two birds with one rock here, and solve both issues at once.

It seems Segment had a "no conflict" option in v1, but it has been deprecated in v2, and it's only usable when self-hosting. (which is not possible in our case, and the no-code service we use don't self-host either)

Dominant language
TypeScript
Stars
477
Forks
160
Avg merge
6h 19m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from segmentio/analytics-next

All issues in segmentio/analytics-next

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.