Overview
The Webflow Browser API is a JavaScript interface exposed via the globalwf object on all Webflow sites with Analyze and Optimize enabled. It requires no manual installation and enables you to manage tracking consent, integrate with Consent Management Platforms (CMPs), track experiment variations, and personalize user experiences.
The Browser API is automatically available on sites with Webflow Analyze or Optimize enabled. No installation required.
Download Skill
Add this skill to your AI agent to help with Browser API integration:Key Concepts
Global wf Object
Automatically available on all sites with Analyze or Optimize enabled
wf.ready() Callback
All Browser API calls must be wrapped in this readiness callback
Consent Management
Three methods to manage tracking consent: get, allow, and deny
Custom Attributes
Set visitor attributes for audience targeting (Enterprise only)
API Methods
The Browser API provides the following methods:| Method | Description |
|---|---|
wf.ready(callback) | Execute code after the Browser API loads |
wf.getUserTrackingChoice() | Returns "allow", "deny", or "none" |
wf.allowUserTracking(options?) | Opt user into tracking |
wf.denyUserTracking(options?) | Opt user out of tracking |
wf.onVariationRecorded(callback) | Register a callback for variation events |
wf.setAttributes(scope, attributes) | Set custom visitor attributes |
Basic Usage Example
All Browser API calls must be wrapped inwf.ready():
Tracking Experiment Variations
Consent Management Integration
The Browser API integrates seamlessly with popular Consent Management Platforms:OneTrust Integration
OneTrust Integration
Sync Webflow’s tracking state with OneTrust consent choices:
TrustArc Integration
TrustArc Integration
Respond to TrustArc consent events:
Custom Consent Solution
Custom Consent Solution
Build your own consent banner:
Custom Visitor Attributes
Custom JavaScript attributes via
setAttributes() are only available on Enterprise sites.Important Notes
- The Browser API is only available on sites with Webflow Analyze or Optimize enabled
- Custom JavaScript attributes are Enterprise-only
- Place scripts in
<head>custom code for earliest possible execution - Consent choices can be persisted with the
persistoption
Reference Documentation
The skill includes comprehensive reference documentation:Getting Started
- introduction.md — Overview, capabilities, placement options, getting started
- wf-ready.md —
wf.ready()API reference
Consent Management
- consent-management.md — Consent APIs, CMP integrations (OneTrust, TrustArc), custom consent solutions
Optimize
- optimize-overview.md — Optimize overview and quickstart
- variations.md — Variations concept and
onVariationRecorded()API reference - attributes.md — Custom attributes and
setAttributes()API reference