Enviornment variable per enviornment

I have a script in the footer tag with scripts for Google Analytics, Dynatrace, etc. There are values in the script that are based on whether the site is pre-prod or prod. When I deploy sites using Github actions or other CI/CD, I can use env variables to handle this. Is there some way I can do this in Webflow?

It seems like this would be a problem for any larger site that validates pre-prod before promoting to production. Any ideas on how I can fix this in WebFlow?


Here is my site Read-Only: LINK
(how to share your site Read-Only link)

Hi there,

While Webflow’s built-in variables are primarily designed for styling properties like colors, sizes, fonts, and custom CSS values, there are several approaches you can consider for managing environment-specific configurations:

You can use JavaScript conditions in your custom code to check the current domain and load different configurations accordingly. Another option is to utilize third-party services like ConfigCat or LaunchDarkly that provide feature flags and configuration management capabilities through their JavaScript SDKs.

For script management in the footer tag, you can organize your code using separate JavaScript files for each environment and control their loading through conditional logic based on the domain name.

Hopefully this helps! If you still need assistance, please reply here so somebody from the community can help.

Check the hostname for .webflow.io, that’s pre-prod.

Outside of that there is no native mechanic for staged code or content distinctions.

When I’m using a reverse proxy, sometimes I’ll RP the .webflow.io staging site as dev.mysite.com, and adjust the scripts for dev and test environments.

If you want to take it that far, you can see some notes on how Sygnal approaches this here in the DevProxy module of our SSE Webflow dev framework.