Site Tracking and Consent Management
Use Webflow’s Browser APIs to manage user tracking consent for Analyze and Optimize. Check consent status, control tracking, and integrate with your consent management platform—or build your own custom solution.
Site tracking
Webflow’s Site tracking lets you record analytics, personalize experiences, and run AI-powered tests using Analyze and Optimize. Site tracking must be enabled to use the consent management APIs.
Privacy laws like GDPR and CCPA may require you to obtain visitor consent before tracking, depending on your site’s location and audience. It’s your responsibility to determine which requirements apply to your site. Webflow’s APIs provide the tools you need to implement consent flows for data tracking as needed. Learn more about compliance requirements.
Consent management
A consent management solution lets visitors choose how their data is collected. Typically shown as a banner or menu, it allows users to opt in or out of tracking. Using a consent management solution helps you inform visitors and manage their preferences.
Consent management apps in the Webflow Marketplace
Webflow offers third-party apps for consent management in the Webflow Marketplace. These apps help you set up and manage consent workflows without writing code. Additionally, Webflow provides detailed setup guides for the DataGrail and Finsweet apps.
Consent Management using Webflow’s APIs
Webflow’s Browser APIs let you check a user’s tracking preferences and manage consent directly. Use these APIs to build a custom consent management solution tailored to your site and user experience. This approach is ideal for:
- Site owners who need to manage consent themselves
- Developers integrating with existing Consent Management Platforms (CMPs)
- Teams requiring specific customization of the consent experience
Consent management APIs
The following APIs are available in the Webflow Browser API:
- Get consent status: Returns the user’s current consent state
- Allow User Tracking: Opts users into Webflow’s tracking
- Deny User Tracking: Opts users out of Webflow’s tracking
Integrating with existing consent management platforms
If you already use a consent management platform like OneTrust or TrustArc, you can add a custom code snippet using the consent management APIs in the header of your site to pass user consent choices to Webflow. The following examples show how to detect user consent choices in your consent management platform and update Webflow’s tracking preferences in real time.
General
OneTrust
TrustArc
To respect user consent, detect the visitor’s choice in your consent management platform and update Webflow’s tracking preferences with the appropriate API call. Most platforms provide a callback or event when consent changes—use this to trigger the allowUserTracking
or denyUserTracking
API calls.
Create your own consent management solution
If you don’t use a consent management platform, you can build your own with Webflow’s APIs. The following examples show how to add a cookie consent modal to your site and manage user consent.
-
Add the modal in the Webflow Designer:
This code will add a cookie consent modal to a page on your site.- Copy the “Designer API Example” code below
- Open the Designer API Playground
- Paste the code into the Playground and run it to add the banner to your page.
- Optional: To ensure the modal is displayed on every page, you can convert it into a component and add it to all pages on your site.
-
Enable consent logic with custom code:
This code will connect the modal buttons to Webflow’s consent APIs, so clicking “Accept” or “Decline” updates the user’s consent status. It also uses GSAP to animate the modal in and out.- Copy the “Custom Code Example” code below
- In your Webflow project, go to your site settings
- Paste the code into the Header section
- Enable GSAP in your site settings
- Publish your site and interact with the modal.
-
Check consent status in your browser:
You can see the current consent status using your browser’s Developer Tools.-
Open your website in a browser (such as Chrome).
-
Right-click anywhere on the page and select Inspect to open Developer Tools.
-
Click the Console tab at the top of the Developer Tools panel.
-
Paste and run the following command to display the consent status.
-
This example is intended as a starting point and may not fully comply with all privacy laws. Customize and validate your consent management implementation to ensure it aligns with your site’s privacy policy and the legal requirements applicable to your visitors.