Manage global variables

This article provides information on adding, editing, and deleting global variables that can be used in event and visitor functions.

The store is a key-value map used to manage global variables that can be accessed by event and visitor functions. Global variables can be added, edited, and deleted from the Code tab of the functions code editor. Event and visitor functions can can retrieve the value of a global variable using the store.get() method. For more information, see Event and Visitor Functions.

Add a global variable for event or visitor functions

To add a global variable, follow these steps:

  1. in the Server-Side, navigate to Functions > Overview.
  2. Select an event or visitor function, then click the Code tab.
  3. Click Global Variables, then click + Add Variable.
  4. Enter a Name for the variable.
    The Key field is automatically populated with the specified name.
  5. Enter the Value of the variable.
  6. Click Add, then click Close.
  7. Click Save/Publish.

Edit a global variable

To edit a global variable, follow these steps:

  1. in the Server-Side, navigate to Functions > Overview.
  2. Select an event or visitor function, then click the Code tab.
  3. Click Global Variables.
  4. In the menu for the variable, click Edit.
  5. Modify the Name and Value as needed, then click Done.
  6. Click Close, then click Save/Publish.

Delete a global variable

To delete a global variable, follow these steps:

  1. in the Server-Side, navigate to Functions > Overview.
  2. Select an event or visitor function, then click the Code tab.
  3. Click Global Variables.
  4. In the menu for the variable, click Delete.
  5. Click Close, then click Save/Publish.

Was this page helpful?

This page was last updated: January 7, 2023