Segment, set up from a tracking plan
Segment collects events from your site once and forwards them to analytics, CRM and email tools. We set it up with a tracking plan so the data stays consistent as tools change.
How we set it up
The method depends on where your site is built. Here is what we use for Segment on each platform.
Framer
On Framer we add the Analytics.js snippet in custom code with loading deferred until consent. Calls to identify and track run from small code components or form events. Complex logic is limited on Framer, so we keep the client tracking plan short and send richer events from your product.
Framer development EmbedWebflow
The Analytics.js snippet goes in Webflow’s head custom code, with the load call held back until the consent banner returns a choice. Webflow form submissions trigger identify and track calls, so new leads appear in every connected tool with the same traits.
Webflow development Official npm packageAstro
In Astro we use @segment/analytics-next in a small client script, loaded after consent, with destinations filtered by the categories the visitor accepted. Server-side events, like a form handled by an Astro endpoint, go through Segment’s Node library instead.
Astro development Official npm packageNext.js
We use @segment/analytics-next in a client provider, call page on route changes and identify after sign-up. Sensitive or high-value events are sent from the server with Segment’s Node library, so they are not lost to ad blockers.
Next.js developmentWhat teams use it for
One event, many tools
A demo request is tracked once and reaches GA4, the CRM and the email tool with the same name and traits.
Switch tools without re-tagging
Replacing an analytics or email vendor becomes a destination change, not a site rebuild.
Site and app identity
Anonymous site visits join the user profile after sign-up, for full journeys.
What to watch out for
Segment forwards data to many vendors. Load only consented destinations and keep personal data out of event properties.
Without a tracking plan, event names drift and every downstream tool inherits the mess.
Client-side destinations can add their own scripts. Prefer server-side or cloud-mode destinations when possible.
Questions about Segment
Do we need Segment?
What is a tracking plan?
How does Segment handle cookie consent?
Should events go from the browser or the server?
How long does a Segment setup take?
Thomas OldenburgerFounder, design and build leadStill deciding? A 30-minute call answers most of it.
Related integrations and services
PostHog
Product analytics, session replay and feature flags, with an EU cloud option.
OpenCustomer.io
Behavior-based email, push and in-app messaging for product-led SaaS lifecycle campaigns.
OpenGoogle Tag Manager
One container for all your analytics and marketing tags, with consent rules and version history.
OpenAgentic workflows
Clean event data is what lets automated workflows act on behavior.
Open