- 24 Sep 2025
- 8 Minutes To Read
- Print
- DarkLight
- PDF
Create a Custom Variable
- Updated On 24 Sep 2025
- 8 Minutes To Read
- Print
- DarkLight
- PDF
Whatfix enables you to create a Custom Variable based on the values fetched from your end user’s application. Use the Custom Variable in multiple content and widgets, pre-fill the fetched values in a Pop-up, and Auto Input fields using a Smart tip.
Note:
Custom Variables is a Beta feature. To enable this feature, contact support@whatfix.com.
How to create a Custom Variable?
Use the following steps to create a Custom Variable:
On the Whatfix Guidance dashboard, click Settings.
Click Advanced customisation.
Click User rules.
Click Create Rule.
In the Create Rule dialog box, click Variables.
Click Continue.
Enter Variable name for your reference.
Enter a Description for the Variable.
In the Default Value field, enter a value that the variable can default to if Whatfix cannot fetch any value from the application.
Add the following conditions to a Custom Variable:
Info:
Expand the following accordions to learn more about the variable conditions:
Where do you want to capture the variable?
Define the specific page of application (using URL or page conditions) where the variable should be evaluated.
The following table lists all the Where conditions you can set for the variable:
Show on
Description
URL
Use this condition to specify that the variable should be evaluated on the entire URL specified.
Domain
Use this condition to evaluate the variable on a specific domain. The domain or the hostname is the first part of the URL.
URL path
Use this condition to evaluate the variable on a specific section of a URL. The section or path is the part of the URL after the domain name but before parameters or hashes.
URL parameter
Use this condition to evaluate the variable based on parameters in the URL.
URL hash value
Use this condition to evaluate the variable based on the hash value of the URL. Hashes are often found in Single Page Applications developed using AngularJS or ReactJS.
Page tags
Use this condition to evaluate the variable based on Page Tags. For example, use a tag called 'asia-content' to evaluate the variable specific to the Asia region. For more information, see Create Role or Page based Tags.
What values should the variable store?
Define the exact data to capture, such as element text, field values, cookies, storage items or window variables.
Whatfix enables you to select from the following options:
Element
Whatfix enables you to target specific elements in your application to fetch values when those elements are present. For example, if you want to show a Self Help widget only when the user is not logged in, choose the login button as the target element.
Use the following steps to select an element as an identifier:
Using the What would you like to identify? dropdown, select Element.
Click Select element using studio.
Enter the URL of the page from which you want to select the element.
Click Select element.
On the redirected page, use Whatfix Studio to select the desired element.
Your title goes here
Click Add display rules icon to add or edit display rules for the selected element. For more information, see Selected Element conditions.
Click Reselect element icon to reselect the element on the application.
Local storage
Local Storage is a type of web storage that is used to store data on the client’s side. It stores data with no expiration time. Data persists even after the browser is closed and reopened, making it useful for long-term storage across multiple sessions.
Whatfix enables you to fetch values based on specific values stored in local storage. Consider that you want to show a specific widget only when the user turns on the dark mode.
Use the following steps to select a local storage key as an identifier:
Using the What would you like to identify? dropdown, select Local storage.
In the Key field, enter the name of the key you want to identify.
Session storage
Session Storage is a type of web storage that is used to store data on the client’s side. It stores data for the duration of a single browser session. Data is kept only as long as the browser or tab is open. Once the browser or tab is closed, the data is cleared.
Whatfix enables you to fetch values based on specific values stored in session storage. Consider that you want to show a Smart Tip segment on your application only after a user has clicked a certain number of times during their session.
Use the following steps to select a session storage key as an identifier:
Using the What would you like to identify? dropdown, select Session storage.
In the Key field, enter the name of the key you want to identify.
Cookie
A cookie is a small piece of data stored on a user's device by their web browser. It is used to remember information about the user, such as login credentials, site preferences, or session data, across different visits to a website.
Whatfix enables you to fetch values based on specific values stored in cookies. For example, if you want to show a particular Tasklist only when a user’s cookie data indicates they are from a specific country, choose Cookies as your identifier. Specify the cookie key you want to monitor and define the required value for that key. The widget appears only when the cookie key matches the specified value, allowing you to present content that is relevant to the user's geographic location.
Use the following steps to select a cookie key as an identifier:
Using the What would you like to identify? dropdown, select Cookie.
In the Key field, enter the name of the key you want to identify.
Window variable
A Window Variable can be used when you need to make some widget available based on a global Javascript variable that is present in the application or based on the one you created in Whatfix Advanced Customization. For example, if you want to check the user's role, set the condition user.role='admin'. This enables you to display a widget for specific user roles.
Info:
To determine which Window Variable to use or to configure a Window variable, contact support@whatfix.com.
Use the following steps to select a Window Variable as an identifier:
Using the What would you like to identify? dropdown, select Window Variable.
In the Key field, enter the name of the key you want to identify.
Who should the variable be captured for?
Set the target audience based on user types or attributes (for example, role, cohort, or enterprise-specific attributes).
The following table lists all the Who conditions you can set for the variable:
Identify user based on
Description
Enterprise Attributes
Attribute condition rules enable you to fetch specific information based on roles, departments, geography, accounts, and more. Once the attributes are integrated with Whatfix, you can see them in the as a display condition for the variable. For more information, see Attributes as Visibility Rules.
If you need to fetch your application information for content segmentation, Enterprise Attributes can enable you to fetch this data for use within Whatfix.
User Attributes
If you need to segment content based on end-user information from your application, User Attributes enable you to fetch this data for use within Whatfix. For more information, see Attributes as Visibility Rules.
Roles
Whatfix enables you to show different content to different users with the use of Role tags. For example, an admin user can be shown more and different content when compared to a basic user. This helps in targeting information based on what users can do on your application. For more information, see Tags as Visibility Rules.
Cohorts
Create Cohorts for specific users based on certain use cases to show Whatfix content. For example, show a Pop-up to new users who have spent 7 days or less in the system and have completed 3 Tasks about the latest version of the application. For more information, see Add Cohorts as Visibility Rules.
Salesforce Objects
Salesforce Lightning objects are properties that help Whatfix serve relevant content to Salesforce Lightning users based on existing Salesforce Lightning properties that help identify different users. Using Salesforce Lightning objects help you to show relevant content to your users easily.
Salesforce objects are only applicable for Salesforce app and show up if your app is configured as such. For more information, see Use Salesforce Lightning Objects for Whatfix Content Segmentation.
Once you have configured all the conditions for the Variable, click Save.
Use the toggle to enable the Custom Variable.
Note:
You must publish the Custom Variable from the Ready stage.
Custom Variables are designed to persist temporarily so they remain useful without causing repeated or irrelevant triggers. Expiry ensures that variables stay relevant to the user’s current context while preventing outdated or persistent values from causing unwanted content to reappear. Here are a few examples:
When a Custom Variable is evaluated and its value changes in the application, the CV is updated automatically.
If you log out of the application, or if local storage, session storage, or cache is cleared, the CV expires. When you log back in and perform an action, the CV is re-evaluated.
If the value remains unchanged (for example, a username that stays constant), the CV expires after 7 days to ensure it remains current and relevant.
Use Cases for Custom Variables
Expand the following accordions for more details:
Display a Pop-up based on an element text
Configure a Pop-up to appear only when a specific element is present on a page. For example, on the Salesforce Opportunities page, the Pop-up appears only if the element text equals to Opportunity Name. This ensures that the Pop-up is shown in the right context, only when the user is working with an opportunity.
The following GIF shows how you can display a pop-up based on an Element text:
Personalize Pop-ups with the end user’s name
During onboarding in Salesforce, you can make Pop-ups more engaging by automatically inserting the user’s name from the application.
Adding the variable within curly brackets: For example, {variable_name} in a Pop-up enables you to display messages such as Welcome, John!, making onboarding more personal, thoughtful and more appealing to each new member.
The following GIF shows how you can personalize a pop-up with the user’s name:
Fetch and auto-input a specific value with Smart Tips
Consider the following scenario: when submitting job applications in Bullhorn, users often missed entering their manager’s email in the notification field. As a result, the initial round of manager review was often missed and this caused delays.
Create a Custom Variable to fetch the manager’s name from the application and use an Auto Input Smart Tip to automatically fill the notification field. This reduces errors, ensures the correct information is always included and a the manager always receives applications for review.
Here’s how you can achieve this: