Segment
Last updated May 10, 2026
Segment lets you collect analytics events in one place and forward them to downstream destinations. The segment() helper creates Segment's standard window.analytics queue, optionally queues the initial page() call, and loads Analytics.js when measurement consent is available.
Integrate with c15t
How c15t loads it
- Category:
measurement(Analytics) - Loads when: measurement consent is granted
- On revocation: unloaded - c15t removes the script from the DOM and clears Segment globals until consent is granted again.
Configure the integration
By default the helper queues analytics.page() before the vendor bundle loads. If you want to handle page views yourself, set trackPageView to false.
Tracking events in your app
c15t gates the Segment script from loading until measurement consent is granted. Your application code that calls Segment's runtime API (window.analytics.track, identify, etc.) is not automatically gated - window.analytics does not exist until the script is loaded, so unguarded calls before consent throw.
Guard event calls by checking consent state. From React:
From plain JavaScript: