Segment

Segment

Customer data platform and analytics router that collects behavioral events from websites and forwards them to any connected destination (analytics, CRM, ad platforms). The Segment Analytics.js library fires a single tracking call that fans out to dozens of integrations, reducing the need for multiple vendor scripts.

Overview

Segment is a customer data platform (CDP) that collects behavioral events from websites and routes them to analytics, CRM, and advertising destinations. It acts as a single data collection layer that replaces the need for multiple vendor-specific tracking scripts. Rather than managing separate integrations for Google Analytics, Mixpanel, HubSpot, and Facebook Ads, teams instrument Segment once and configure data routing to downstream destinations from Segment's dashboard. Twilio acquired Segment in 2020, and the platform is now part of Twilio's customer engagement stack.

What This Script Does

Analytics.js is the primary browser SDK, loaded from cdn.segment.com (or a proxied first-party domain if the site uses Segment's custom domain feature). The script is typically around 50–100 KB and initializes with the site's write key embedded in the snippet.

Automatic data collection: On load, Analytics.js fires a page() call capturing the URL, referrer, page title, and UTM parameters. Subsequent page navigations in single-page applications trigger additional page() calls if the site uses Segment's history API integration.

Identity and cookies: Segment sets a first-party cookie named ajs_anonymous_id (2-year expiry) containing a UUID that persists across sessions to identify the same browser over time. When a user logs in or signs up, a identify() call links the anonymous ID to a known user ID, email, or other traits. A ajs_user_id cookie stores the resolved identity. These cookies are set under the site's own domain when using the default configuration.

Track events: Custom track() calls instrument business events — "Product Viewed," "Added to Cart," "Order Completed" — with associated properties (product ID, price, category). These events are sent to api.segment.io (or events.eu1.segmentapis.com for EU-hosted workspaces) and fanned out to configured destinations.

Destination routing: Downstream integrations connected to Segment may include Google Analytics 4, Amplitude, Mixpanel, HubSpot, Salesforce, Facebook Conversions API, Customer.io, Braze, and hundreds of others. Some integrations load additional client-side scripts ("device-mode destinations") bundled into the Analytics.js payload, while others operate server-side ("cloud-mode destinations") where data flows from Segment's servers to the destination without additional browser-side code.

Segment Personas / Twilio Engage: Sites using Segment's CDP capabilities build user profiles from accumulated event data, enabling audience segmentation and personalized marketing automation.

Consent & Compliance

Segment is classified under the analytics consent category, though its effective scope extends to marketing when advertising or marketing automation destinations are configured. Because Segment is infrastructure for routing data to any downstream tool, its consent requirements are at least as broad as the most sensitive destination connected to it.

Under GDPR, Segment processes personal data (browser identifiers, behavioral events, linked user identities) and routes it to third-party controllers and processors. This requires a lawful basis — typically consent under Article 6(1)(a) — before the ajs_anonymous_id cookie is set and before data is transmitted. The ePrivacy Directive requires consent before any non-strictly-necessary cookies are set. Segment provides a consent management integration that can gate event collection until consent is obtained.

Under CCPA/CPRA, the fan-out of user behavioral data to advertising platforms (Meta, Google Ads, etc.) may constitute a sale or share of personal information, requiring opt-out mechanisms. Segment is enrolled in the EU-US Data Privacy Framework and offers EU-region data residency (events.eu1.segmentapis.com) for workspaces that require EEA data to stay in Europe. Segment's DPA is available on their website and covers standard SCCs for international transfers where DPF does not apply.

IAB TCF purposes relevant to connected marketing destinations typically include Purpose 1 (Store and/or access information on a device), Purpose 7 (Measure ad performance), and Purpose 8 (Measure content performance).

Should You Block This Without Consent?

Yes. Segment sets persistent identity cookies and routes behavioral data to third-party services before the user has had an opportunity to consent. Even if Segment itself is analytics infrastructure, blocking it until consent is obtained is required because it immediately sets the ajs_anonymous_id cookie and begins data collection on load. Use Segment's built-in consent tooling or your CMP's integration to delay initialization until the user grants at least analytics consent.

Is Segment GDPR compliant?

Segment typically loads analytics trackers, which are not strictly necessary for your site to work. Under the GDPR and the ePrivacy Directive, non-essential cookies and trackers must stay blocked until a visitor gives clear opt-in consent. So Segment can be fully GDPR compliant, but only if your site holds its scripts until consent is granted and lets visitors decline just as easily. Compliance depends on how your site loads Segment, not on Segment itself.

Visit website

Consent Categories

Also Known As

Segment Analytics.jsSegment CDPTwilio Segmentcustomer data platformanalytics router

Industries

Computers Electronics and Technology

Tracked Domains (2)

cdn.segment.comAnalytics

cdn.segment.com is an analytics domain operated by Segment, used to measure visits, sessions, and on-site behavior.

api.segment.ioAnalytics

api.segment.io is an analytics domain operated by Segment, used to measure visits, sessions, and on-site behavior.

Cookies Segment Sets (2)

ajs_anonymous_id

Segment anonymous visitor identifier set on the customer apex by analytics.js. One-year expiration.

ajs_user_id

Segment user identifier set on the customer apex when analytics.identify() is called. One-year expiration.

Frequently Asked Questions

Related Vendors

Bazaarvoice
Bazaarvoice
Bazaarvoice is an enterprise ratings, reviews, and UGC syndication network used by major global brands. Scripts embed review display widgets, Q&A sections, and photo galleries on product pages. Reviews are syndicated across Bazaarvoice's retailer network, and collected UGC is used in social advertising and shopper insights programs.
Sprinklr
Sprinklr
Sprinklr embeds social monitoring widgets and customer engagement tools on websites. Scripts collect user interaction data, social feed content, and engagement metrics to support unified customer experience management across marketing and service channels.
MoEngage
MoEngage
MoEngage scripts collect behavioral events and user session data to power personalized push notifications, in-app messages, and email campaigns. The SDK tracks page views, clicks, and custom events to build audience segments for cross-channel targeting.
Semrush
Semrush
Semrush embeds website traffic widgets and competitive analysis badges on partner and third-party sites. Scripts may load analytics data visualizations and set tracking cookies to measure widget engagement and attribute referral traffic to the platform.
Adjust
Adjust
Mobile attribution platform that measures which marketing channels and campaigns drive app installs. Adjust's web SDK fires attribution events on landing pages to connect ad clicks to downstream app activity. Sets cookies to track cross-device conversion paths.
RudderStack
RudderStack
RudderStack is an open-source customer data pipeline that collects events from websites and apps and routes them to data warehouses and downstream tools. SDK scripts instrument web pages to capture page views, track calls, and identify users, forwarding events to configured destinations. Supports self-hosted and cloud-managed deployments.

Manage consent for Segment

ConsentStack automatically detects and manages Segment trackers so your site stays compliant with global privacy regulations.