Segment Analytics.js
Reasonable, with limits. 7th of 9 product analytics SDKs.
Analytics.js 2.0 (@segment/analytics-next) is the official browser SDK for Twilio Segment, a paid customer data platform. It is mature and typed, and it is the right pick if you already route events through Segment. For new product-analytics work, PostHog grows much faster and its repository is far more active.
Best for: Teams that already pay for Segment and want one event stream routed to many downstream tools.
Scores
Overall6.5
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 5.5, likely 4.5 to 6.5
If your company runs on Segment, this is the correct and well-supported SDK to use. As a choice for a new project's analytics, it ties you to a costly paid CDP, its repository is quiet, and it is growing more slowly than its peers. PostHog JS is the better default for most new product-analytics work.
- peers PostHog JS: About 12x yearly growth and 2,935 commits, against Segment's 3.3x and 44.
- dev.to/juan_diegoisazaa_5362a/segment-alternatives-practical-picks-for-2026-34oe: Points teams that mainly want product analytics to PostHog, Amplitude or Mixpanel.
- github.com/segmentio/analytics-next/issues: Unanswered bugs show limited maintenance attention.
GPT-6.2 Sol: 7.4, likely 6.2 to 8.5
Segment is a strong choice for new web projects that need reliable event delivery to several destinations and already want Twilio Segment. PostHog JS is the stronger default for a new team that wants autocapture, replay, and product reporting in one setup. The value of central routing varies by project, and below-median download growth gives limited confidence that Segment is gaining share.
- twilio.com/docs/segment/connections/sources/catalog/libraries/website/javascript: Documented browser tracking, delivery controls, and destination routing.
- posthog.com/docs/libraries/segment: Full PostHog browser features require its own SDK or snippet.
- npm.versionsLastYear; npm downloads; medianDownloadsRatio; peers: Active browser releases and slower relative download growth than the catalog median.
Needed by many5.4
How many developers need a tool for this job?
Claude Opus 5.5: 4.5, likely 3.5 to 6.0
Many web app teams need product analytics. This SDK serves only the subset that uses Segment as a CDP or event router. It runs in browsers only, and a Node package from the same monorepo covers servers.
- dev.to/juan_diegoisazaa_5362a/segment-alternatives-practical-picks-for-2026-34oe: Says Segment's routing layer is often more than teams that only want product analytics need.
- twilio.com/docs/segment/connections/sources/catalog/libraries/website/javascript.md: Official docs present it as the website source for Segment.
GPT-6.2 Sol: 6.2, likely 5.1 to 7.3
A large share of web product teams need to measure user behavior. This package serves browsers across frameworks, with the strongest fit for teams that route the same events to several systems. Web measurements show how common analytics is, with less certainty about how many teams need that routing layer.
- almanac.httparchive.org/en/2025/third-parties: Analytics ranks among the most common third-party request categories.
- twilio.com/docs/segment/connections/sources/catalog/libraries/website/javascript: Browser tracking API and routing to multiple destinations.
- alium.io/research/what-engineers-want-from-product-analytics: Buyer interviews describe both all-in-one analytics and warehouse-based setups.
Helps a lot6.9
How well does it do the job for those who need it?
Claude Opus 5.5: 6.0, likely 5.0 to 7.0
It is a mature, typed SDK with plugins, batching, a consent hook and a large destination catalogue. Open issues show real rough edges: dynamic imports break when re-bundled, storage quota errors, config options with no effect, and CSP problems from loading remote destination code. It does no analysis itself and depends entirely on the paid Segment service.
- github.com/segmentio/analytics-next/issues: Open bugs on Vite/esbuild bundling, storage, cookie config, types and CSP.
- npm hasTypes: Ships its own TypeScript types.
- twilio.com/docs/segment/connections/sources/catalog/libraries/website/javascript.md: Docs report a bundle about 70% smaller than classic analytics.js.
GPT-6.2 Sol: 7.8, likely 6.6 to 8.8
Version 1.84.4 offers a straightforward typed API, documented setup examples, retries, batching, and middleware. The examples give coding agents clear patterns for basic tracking, though agent accuracy has little direct evidence. A rebundling issue and the page-load cost measured in one test highlight limits that depend on the build and enabled destinations.
- twilio.com/docs/segment/connections/sources/catalog/libraries/website/javascript: Tracking, delivery settings, middleware, and debugging documentation.
- github.com/segmentio/analytics-next/blob/master/packages/browser/README.md: Typed browser setup and delayed initialization examples.
- github.com/segmentio/analytics-next/issues/1332: User reports an initialization crash after rebundling with Vite.
- datasaas.co/blog/analytics-script-benchmark: A single synthetic test measured 71.8 KB compressed and 142 ms added to LCP.
- github.com/segmentio/analytics-next/releases/tag/%40segment%2Fanalytics-next%401.84.4: Current stable release fixes rounding of long anonymous IDs.
Holds up over time6.7
Will it still be a good choice in two years?
Claude Opus 5.5: 6.0, likely 4.5 to 7.5
Twilio funds it and it still ships: 11 releases in the last year, the latest on 2026-11-17. Commit volume is low next to peers (44, against PostHog's 2,935 and Amplitude's 565), and many issues get no visible reply. Twilio reviewed whether to sell Segment and decided to keep it, which lowers but does not remove the risk around the business unit.
- github commitsLastYear: 44 commits, far below active peers.
- github releasesLastYear: 11 releases; latest 1.84.4 on 2026-11-17.
- cxtoday.com/twilios-pivot-from-the-swiss-army-knife-of-cx-to-a-more-cohesive-platform-is-working: Twilio decided to keep Segment after a strategic review.
- github.com/segmentio/analytics-next/issues: Issues from 2025 and 2026 sit open with no comments.
GPT-6.2 Sol: 7.3, likely 6.1 to 8.5
Twilio maintains Analytics.js as a flagship SDK, and the browser package published eight versions in the past year. Recent fixes shipped within the 1.x line, though one browser rebundling report has stayed open for about a year. The shared repository has a quieter commit cadence than PostHog’s or Amplitude’s, and long-term support depends on Twilio’s priorities for Segment.
- npm.versionsLastYear: Eight browser package versions in the past year.
- github.commitsLastYear; peers: 44 commits across the browser and Node monorepo, below several peers.
- github.com/segmentio/analytics-next: Twilio lists the SDK as a maintained flagship library.
- github.com/segmentio/analytics-next/releases: Recent browser updates fix delivery and identity behavior within 1.x.
- github.com/segmentio/analytics-next/issues/1332: Browser rebundling report opened in November 2025 remains open.
Used widely6.2
How many use it, and is that growing?
Claude Opus 5.5: 6.0, likely 5.0 to 7.0
It had 10.8M downloads in four weeks, up 3.3x on a year ago. That is below the 4.1x median, so it is losing ground, while PostHog grew about 12x. Only 398 dependent repositories were counted, fewer than Mixpanel (1,218) or PostHog (2,707). Many installs probably come from CI and from enterprise apps rather than from new choices.
- npm downloadsLast4Weeks: 10.8M against 3.3M a year ago, a ratio of 3.27 versus the 4.1 median.
- dependents repos: 398 repos and 93 packages, low next to peers.
- bluesky posts: Zero Bluesky posts and zero HN stories.
GPT-6.2 Sol: 6.3, likely 5.1 to 7.5
Monthly npm downloads grew 3.27×, below the catalog median of 4.1× and well behind PostHog JS, suggesting Segment lost relative ground. The collector found 398 dependent repositories, close to Amplitude and below Mixpanel and PostHog. BuiltWith detects Segment on about 125,000 live sites, capturing web use that npm misses, though the detections include multiple versions and installation methods.
- npm.downloadsLast4Weeks; npm.downloadsSame4WeeksYearAgo; medianDownloadsRatio: 10.79 million downloads versus 3.31 million a year earlier.
- dependents; peers: 398 repositories and 93 packages, with fewer tracked repositories than several peers.
- trends.builtwith.com/analytics/Segment: About 125,000 live sites detected using Segment.
- usermaven.com/research/b2b-saas-tracking-stack-audit: October 2026 audit detected Segment on 5.5% of 1,110 B2B SaaS sites.
Vouched for6.1
Who stands behind it being good?
Claude Opus 5.5: 5.5, likely 4.0 to 7.0
Segment is a long-established CDP with many enterprise customers, and it gets a lot of reviews on sites like Capterra. I found no independent benchmarks or developer-survey data on the SDK itself, and no current community discussion of it. Most comparisons I found are written by competing vendors.
- capterra.com/p/150621/Segment/reviews: Large body of user reviews for the Segment platform.
- amplitude.com/compare/best-segment-alternatives: Vendor comparison that calls Segment powerful but expensive.
- hackerNews stories: No community discussion found in HN or Bluesky.
GPT-6.2 Sol: 6.6, likely 5.4 to 7.8
PostHog documents a Segment integration for core events and identities, and a recent buyer interview describes a developer-tools company keeping Segment for production event logging after changing its reporting stack. Independent evidence is stronger for Segment’s routing workflow than for satisfaction with this specific SDK version. The available performance benchmark covers a single setup.
- posthog.com/docs/libraries/segment: Documented integration for page views, custom events, and identities.
- alium.io/research/what-engineers-want-from-product-analytics: A developer-tools company retained Segment for application event logging.
- datasaas.co/blog/analytics-script-benchmark: Third-party browser benchmark with one test configuration.
Safe7.3
How safe is it to depend on?
Claude Opus 5.5: 7.0, likely 5.5 to 8.5
It has no advisories on record, an MIT licence and 11 dependencies, and a company stands behind the releases. There is no Scorecard data. At runtime it loads destination code from Segment's CDN, which widens the attack surface and can conflict with CSP. Like any tracking SDK, it sends user data to a third party.
- advisories total: Zero known advisories.
- npm dependencies: 11 direct dependencies.
- scorecard: No OpenSSF Scorecard available.
- github.com/segmentio/analytics-next/issues: Issue reports remote Amplitude scripts causing CSP violations.
GPT-6.2 Sol: 7.5, likely 6.3 to 8.6
The SDK uses the MIT license, and the collector found zero advisories against the package itself. Automated releases use npm trusted publishing, and a vulnerable js-cookie dependency was patched about two months after the repository report. Eleven direct dependencies, runtime scripts from enabled browser destinations, and gaps in evidence about repository controls and publisher access keep the range wide.
- npm.license; npm.dependencies; advisories; scorecard: MIT, 11 direct dependencies, zero package advisories, and no Scorecard result.
- github.com/segmentio/analytics-next/blob/master/RELEASING.md: GitHub Actions publishes through short-lived npm trusted credentials.
- github.com/segmentio/analytics-next/issues/1367: The vulnerable dependency was reported in May 2026.
- github.com/segmentio/analytics-next/releases: Browser release 1.84.1 shipped the patched js-cookie dependency in July.
- docs.report-uri.com/platforms/segment: Enabled browser destinations can add remotely loaded scripts.
Good
- One track/identify/page API feeds hundreds of Segment destinations, so you don't need a separate SDK per tool.
- Written in TypeScript, with a plugin and middleware system and a smaller bundle than classic analytics.js.
- MIT licence, no known advisories, and regular releases from a company that funds the work.
- Patterns for track, identify and page are widely documented, so AI coding agents tend to write correct calls.
Bad
- It only makes sense with a paid Segment workspace, and pricing by monthly tracked users gets expensive at scale.
- Repository activity is low (44 commits in a year), and many open issues have no visible maintainer reply.
- Users report bugs with re-bundling in Vite or esbuild, localStorage limits, CSP violations from remote destination scripts, and type mismatches.
- Downloads grew more slowly than the median, and much more slowly than PostHog or Vercel Analytics.
The numbers
- npm downloads, 4 weeks
- 11M ×3.3 in a year
- GitHub stars
- 480
- Commits, 12 months
- 44
- npm version
- 1.84.4 Nov 2026
- Versions, 12 months
- 8
- Advisories, 24 months
- 0 of 0 ever
- OpenSSF Scorecard
- None
- Licence
- MIT
The SDK of an analytics service that is not open source.
Read on 21 November 2026 from GitHub (segmentio/analytics-next), npm (@segment/analytics-next), OSV and the OpenSSF Scorecard.
Product analytics SDKs
- 8.2PostHog JS
- 7.3Amplitude SDK
- 7.3Plausible tracker
- 7.0Mixpanel SDK
- 6.8RudderStack SDK
- 6.5OpenPanel
- 6.5Segment Analytics.js
- 6.2Vercel Analytics
- 4.9Analytics