Segment gives a Webflow site a single place to manage tracking across every analytics and ad platform.
If you want to set it up properly, load Segment once, send every event through it, and pass the conversions Webflow needs into Webflow’s own Browser API. Webflow Analyze and Optimize don’t read Segment data, so that last part is the one most setups miss.
How the Pieces Fit
| Layer | What It Does |
|---|---|
| Segment (Analytics.js) | Collects page views, track and identify calls. Loaded once, site wide. |
| Segment destinations | Send that data to GA4, ad platforms, the CRM and the warehouse. No vendor scripts pasted into Webflow. |
Webflow Browser API (wf) |
Records custom goals for Analyze and Optimize with wf.sendEvent() and wf.setUserId(). |
Install Segment in Webflow
- In Segment, create a JavaScript website source and copy its Analytics.js snippet.
- In Webflow, open Site settings > Custom code.
- Paste the snippet into Head code, save and publish.
A few rules I follow:
- Add the snippet once, at the site level. Don’t paste it again into a page’s custom code.
- Keep the
analytics.page()call at the end of the snippet. Many destinations need it. - Remove the GA4, Meta and LinkedIn scripts that were pasted into Webflow before. Those now come from Segment, and leaving both in place double counts.
- Use a separate source, with its own write key, for the
webflow.iostaging domain.
Segment & Webflow Naming Rules
The two APIs have different rules, so you can’t pass Segment values straight through:
| Segment | Webflow | |
|---|---|---|
| Loading | Calls queue as soon as the snippet runs | Every call goes inside wf.ready() |
| Event name | Usually words with spaces, like Demo Requested |
40 printable ASCII characters or fewer, no spaces, case sensitive |
| Value | revenue or value property |
Not negative, up to two decimals, no currency symbol |
| User ID | Traits can include email and name | No personal information in the userId |
Example: On-Site Conversions With sendEvent
Create each custom goal in Webflow first. wf.sendEvent() only records a conversion when the event name matches the goal exactly.
Then, rather than adding wf.sendEvent() next to every analytics.track() call, listen for Segment’s track events and forward the ones that are goals. This goes in Footer code:
<script>
(function () {
// Segment event name: Webflow custom goal event name
var goals = {
'Demo Requested': 'demo_requested',
'Newsletter Subscribed': 'newsletter_subscribed',
'Order Completed': 'purchase'
};
if (!window.analytics) {
return;
}
analytics.on('track', function (event, properties) {
var goal = goals[event];
if (!goal || !window.wf) {
return;
}
var props = properties || {};
var value = Number.parseFloat(props.revenue != null ? props.revenue : props.value);
wf.ready(function () {
if (value >= 0) {
wf.sendEvent(goal, { value: value.toFixed(2) });
} else {
wf.sendEvent(goal);
}
});
});
})();
</script>
Now one call does both jobs:
analytics.track('Order Completed', {
order_id: 'ord_98412',
revenue: 149.99,
currency: 'USD'
});
Segment sends it to every destination, and Webflow records a purchase goal worth 149.99. On-site conversions show up in Analyze and Optimize in about 15 to 30 minutes.
Example: Off-Site Conversions With setUserId
Some conversions happen after the visitor leaves the site: an application is approved, a deal closes in Salesforce, an account is upgraded in the app. For Webflow to credit those, you have to tell it who the visitor is while they’re still on the site, with wf.setUserId(userDomain, userId).
userDomainis a label for the system the ID comes from, likesalesforceorapplicationId.userIdis the ID in that system. It has to match what your server sends later.- No names, emails or phone numbers. Use a database or CRM ID, or a SHA-256 hash.
- The ID lasts for the session, which ends after 30 minutes of inactivity or 24 hours at most.
I use one helper so Segment and Webflow are always identified together:
window.identifyVisitor = function (userDomain, userId, traits) {
analytics.identify(userId, traits || {});
if (window.wf) {
wf.ready(function () {
wf.setUserId(userDomain, String(userId));
});
}
};
// After a form or login returns an ID
identifyVisitor('applicationId', '123456789', { plan: 'enterprise' });
Email and name can still go to Segment as traits. Only the ID goes to Webflow.
Sending the Off-Site Conversion
When the conversion happens, your server reports it to Webflow’s server-side API with the same userDomain and userId:
curl --request POST 'https://log.intellimize.co/event' \
--header 'Authorization: ApiKey YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"customerId": "your-account-id",
"eventName": "application_accepted",
"userDomain": "applicationId",
"userId": "123456789",
"actionId": "unique-conversion-id",
"actionTimestamp": 1653514258136,
"value": 149.99
}'
- The token is created in Webflow under Insights > Tracking Settings.
actionTimestampis UTC, in UNIX milliseconds. It can’t be in the future or more than 2 days old.- The custom goal has to exist before the conversion happens.
- The conversion has to fall inside the same session as the visit to be credited to an Optimize variation.
- Off-site conversions import nightly at midnight UTC, so today’s won’t appear until tomorrow.
If the conversion already passes through Segment as a server-side event, a Segment destination function or webhook can make this request, so the CRM doesn’t need its own integration.
Consent
Segment and Webflow keep their own consent state. Your cookie banner has to control both, or one keeps tracking after a visitor declines. The same applies to the banner setup I cover in GTM Consent Mode V2 for Webflow.
Check It
- Open the Segment source debugger, load a page and confirm one
pagecall. - Trigger each mapped event and confirm one
trackcall in Segment and no console errors. - Wait 30 minutes and confirm the goal in Webflow Analyze.
- Run the identify flow, send a test request with curl, and check the off-site goal the next day.
If the same conversion is also sent from a server, read server-side tracking event deduplication before turning both on.