Global Variables per Site

Ability to define global key/value variables (data type: strings, integers and dates) that can be used throughout a webflow site.

Use Case:
A company phone number that is used in multiple symbols throughout a design.

  • Tim Daff
  • Aug 2 2018
  • Reviewed
  • Michael Wells commented
    25 Sep 10:37am

    To my last comment, adding API to the needs for get/set these vars. Which of course means, Logic as well.

    The use case I'm currently facing is a requirement to generate aggregateRating JSON+LD markup. Ratings are in a collection, and all are scored, but there's no internal way to get an average and bind it into my markup.

    I can have that calculated externally through Zapier/Make or hopefully via Logic someday, but where to store the resulting average value? It needs to go into a global var that I can then include in my site.

  • Michael Wells commented
    25 Sep 08:30am

    NICE. I just came here looking to add this wishlist item.

    Ideally these vars will need to be strongly typed, e.g.;

    • strings, e.g. for site name

    • emails, e.g. for support@mycompany.com

    • numbers, e.g. "X" customers served

    • phone numbers

    • measurements, especially to support Interactions, where several different parts of an animation need the same measurements e.g. open/close animations

    • timing durations, also for animations

    We'd want the ability to reference these variables from;

    • Designer elements, as appropriate for content, links, emails, default input values, etc.

    • Page config elements, like {{ var.sitename }} in Page titles

    • Scripts, via webflow.js

    Related - https://wishlist.webflow.com/ideas/WEBFLOW-I-1787

  • Jacky Choo commented
    16 Jun 03:41am

    This is going to be useful for us, we have 2 sites (1 for staging, 1 for production) for each of the env i would like to add redirection link to its specific env, eg.

    • Staging -> Staging

    • Prod -> Prod

    Tested the design in staging, export and import to Prod

    With env variables set for the redirect link domain, it doesn't impact the link(reference to global variable), when I export and import my pages from Staging to Prod

    Currently we have to update the link manually everytime.

  • Patina Photo commented
    23 Sep, 2021 04:24am

    Another use case: for pricing info

    e.g. we often mention starting prices for products and service in our copy all across our site (where a CMS or symbol doesn't make sense). It would be great to have this updatable from one location.

  • Ron Ferrell commented
    30 Jun, 2021 02:33am

    I have found a way to do this realtively easily with JavScript and I SUCK at Javascript. I have a snippet of Javascript that changes the Copyright Date on everypagel. Every year it will update itsef. I tried this with just using the company name and it works. It is done on page load so I am not sure the SEO implications/impact. Also this is great for pricing if you do not have enough items to warrant a CMS site - I.E. I have a customer that has one product and is going to sell via PayPal but I want to be able to advertise the price everywhere and not have to worry about changing 50 places or missing one change down the road.

    I am not sure I can paste the code in here so message me and I will send it to you.

  • Michael Wells commented
    22 Dec, 2020 05:14am

    This can be done in a very crude way, using a JSON chunk in your site header, and script to search/replace specific areas you want to apply it. But that's very ugly and prevents clients from managing those variables through the Editor interface.

    I have a similar need for popup notifications, with a chunk of richtext and the ability to turn that alert on/off.

  • Rickard Lindgren commented
    17 Jun, 2020 10:17am

    Yes please

  • TRU MRK Agency commented
    29 Jan, 2020 02:48pm

    Reallllly need this one. Any update? If not, can this be achieved by a script?

  • Justin Maxwell commented
    20 Nov, 2019 10:32pm

    Is there any way we could do a workaround on this with the CMS?

  • Justin Maxwell commented
    20 Nov, 2019 10:31pm

    Yes, please

  • Chris Brewer commented
    3 May, 2019 08:02pm

    More Use Cases:

    • Company Name
    • Company Address
    • [named] Email Address
  • Tim Daff commented
    7 Nov, 2018 12:36am
  • +39