Skip to main content
Skip table of contents

Pick the right variable scope

Last updated: 04 December 2023

Variables have two possible scopes: subscriber or account.

It may be tricky to understand the difference between the two. To help you figure out which scope your next variable should have, here is a breakdown with examples.

Step 1: Find the setting

Go to SettingsVariables.

Create a new variable and, before saving, click Advanced Settings.

Once a variable has been scoped to either Subscriber or Account, it cannot be changed.

The variable scope is in the middle of the modal.

Step 2: Spot Subscriber and Account scoped variables

Go to SettingsVariables.

On the overview page, notice the Scope column. Each variable displays its scope, Subscriber or Account.

Step 3: Understand Subscriber Scope

By default, variables have a Subscriber scope.

If you were to simply create a variable, without clicking Advanced Settings, the variable created would be scoped to the Subscriber.

A variable that is scoped to the Subscriber is a variable that will contain a value different for every one of your subscribers.

A simple example of a variable with a Subscriber scope

Let’s say we want our chatbot to ask its users for their name, and save it into a variable. We’ll then use this variable to say Hello [variable] or to create a new lead inside a CRM associated to the name of the user.

In this example, we expect the value inside the variable to be different for every user.

  • User A will enter Alex, and the variable will store the value Alex.

  • User B will enter Sarah, and the variable will store the value Sarah.

  • User C will enter John, and the variable will store the value John.

And so on.

We definitely don’t want to store the same value for all our users. If we did that, we would end up calling all our users Alex, Sarah, or John.

In this example, this variable therefore need a Subscriber scope.

Typically, the vast majority of the variables you will ever create will be scoped to the subscriber (hence it being the default scope).

Step 4: Understand Account scope

Account scope variables share their value with the entire account.

Instead of the value stored inside the variable changing for every single user, it remains the same across all users.

It’s easiest understood through an example.

A simple example of a variable with an Account scope

On top of being a simple example, it is also the single most likely use case you’ll run into.

Let’s say you create a lead generation chatbot. This chatbot collects information from each of its users such as their name, email address, and budget.

Once the chatbot has collected this information, it is meant to send it all to a third-party software CRM (e.g. Zoho).

But there’s a twist. Zoho requires you to authenticate yourself every single time you try to push data. It does so by requiring you to send a unique token.

So, you create a first integration to allow you to connect to Zoho, create, and retrieve your unique authentication token and store it into a variable.

Then, you create a second integration that will use that variable (with the stored token) every time it pushes a lead to the CRM.

Because the authentication token you retrieve is:

  1. Unique

  2. Used every time you push a lead to Zoho

You create this variable with an Account scope.

Regardless of the lead generated, whether it is Alex, Sarah, or John, the token is always the same. The token is shared across the entire account and, therefore, Account scoped.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.