index
DOCUMENTATION MOVED
Go to the new version of this page at https://docs.gmetri.com/metaverse/build/building-blocks/variables
Variables
GMetri experiences fully embrace "variables". Variables allows you to gamify your experiences and orchestrate a variety of interactions.
note
If you want to add interactivity, you would almost always use variables.
Variables can store three kinds of values:
- String (Any character, word, sentence)
- Numbers
- Booleans (TRUE/FALSE).
Sources
There are three sources of variables in any GMetri experience:
- Custom Variables: These are variables that you add manually to an experience
- Global Variables: You can define certain variables in your workspace settings. These variables are then available for use across all experiences in that workspace. The value of this variable is shared across experiences
- Autogenerated Variables: These get added automatically
tip
Variables are very powerful tools that can be used to gamify any experience.
Custom Variables
Adding Custom Variables
- You can add custom variables by opening Settings > Variables
- Add the variable by clicking on Add Variable Button in the variables tab.
Checking the "track" option allows you to later check the values stored for that variable, for every user, in Analytics Dashboard
Global Variables
Global Variables are shared across all experiences in a workspace. These are helpful if you want to track your users journey across multiple GMetri experiences.
note
When the user moves from one experience to another in the same workspace, the values in global variables is preserved across experiences
Defining Global Variables
- Head over to
Settings
from the top right menu in your Dashboard. - Click
Add Variable
in theGlobal Variables
section
Adding the Global Variables defined above to the experience
- In the Project Editor, go to
Settings
>Varaibles
. - Scroll down to see the
Global Variables
section. Use the dropdown to add the global variable you want to add.
Autogenerated Variables
Some variables are generated automatically when you create an experience. These variables are immutable - their values cannot be changed using rules.
List of auto-generated Variables
score
- This is a special number variable that's used to generate the leaderboard in the analytics section. Use this to store any overall score you may have in the experience.lang
- Thelang
variable can be used by enabling theShow Language Screen
option in the settings section. To add languages, go to theLanguages
tab inside Splash Screen. This variable will hold the value of the language selected by the viewer.v_identifier_var
- A unique ID to identify each viewer who views the experience. This can be viewed in the analytics page. Can be email/name etc. - depends on the authentication mechanism used in the Deployment section.firstname_var
- A string variable that contains the first name of the user if we get it from the authentication mechanism.fullname_var
- A string variable that contains the full name of the user if we get it from the authentication mechanism.device_var
- Holds information about the viewer device type. Possible values:d
,m
,h
.d
-> Desktopm
-> Mobileh
-> Headset
vrmode_var
- ContainsTRUE
if the user enters VR Mode. OtherwiseFALSE
. Changes real-time to reflect the current state.browser_var
- This variable holds the information on the browser that a viewer uses. For a list of support browsers please check the platform compatibility matrix. Following values will be populated in the browser_var when the viewer views an experience:Device Browser browser_var
valueLaptop/PC Safari safari
Laptop/PC Chrome chrome
Laptop/PC Edge edge-chromium
iPhone Chrome crios
iPhone Safari ios
Android Chrome chrome
Oculus Oculus browser samsung
Other actions like enabling Lead Generation
form fields and adding Media Upload elements can also add auto-generated variables.