How to use variables in the IB

Variables are a complex but powerful feature that we can use in order to display dynamic data in our interactions. In this article we will explain how to use variables in interactions, in different ways.

 

This document provides a comprehensive overview of the following topics:

  • How to create and use variables
  • How to access and modify variables
  • How to set visitor variables to giosg
  • How to use Change variables action
  • How to assign variables values using Custom JavaScript

How to create and use variables

Variables enable the integration of dynamic text generated from user-provided values. You can use the values directly or provide a formula for more complex use cases.

This feature is designed to address a variety of real-world applications, including loan and investment calculations, language translations, personalised titles and texts, and much more.

Tutorial on how to create and use variables:  Using variables like user input text inside interactions

How to access and modify variables

Variables can be viewed and modified in the following ways:

  • Double clicking on the existing variable
  • Clicking on the variable and then on Edit variable button

  • Navigate to interaction name then click on the Variables and formulas button.

In order to modify the variable, click on the Value field of that specific variable. You can assign a formula or even another variable value to it.

 

How to use "Change variable" action

Follow the steps below in order to use the Change variable action:

  1. On the right side panel, access Actions tab
  2. Select "Change variable" 

3. Assign a value to the variable

 

How to assign variables values using Custom JavaScript

In order to assign values to elements we can directly use Custom Javascript.

In the example below, the image got the url value, after assigning it using the Custom Javascript:

  1. Navigate to Interaction name and expand it

  2. Click on the Advanced Options
  3. Click on the Open Javascript Editor
     
  4. Assign a url value to your image element. Make sure the image element name matches the name used in the Javascript code:
  5. Go to Preview mode. The url image should be displayed in the image element

How to set visitor variables to giosg

Attaching extra information about the visitor data is possible by setting visitor variables.

Typically this is information such as customer number, customer name or email.

Tutorial on how to set visitor variables: Sending visitor variables to giosg


This document provides guidance on how to create, access, and modify variables to personalise interactions and enable dynamic modifications. By leveraging variables in various contexts, the  user experience becomes way more enhanced.