In Embeddables, User Data refers to the current data stored on a given user.

User Data exists as a JSON object of properties. These properties could be:

  • Answers the user gave to questions (the key would be the input component’s key)
  • A value calculated by a Computed Field (the key would be the computed field’s key)
  • A value set by an Experiment (the key would be the experiment’s key)
  • Other types of properties (see full list below)

Where is User Data stored?

User Data is stored in three places, or ‘contexts’, and each one usually stored a different amount of data.

Contexts are cascading, so if a property is stored in #2, it will also be stored in #1 as well, and so on.

  1. Embeddable Context - This is the full User Data, and is stored within the Embeddable itself. It is not available after the user refreshes or closes the tab.
  2. Local Storage Context - This is the subset of User Data that is stored in the user’s browser, in Local Storage. It’s used to remember a user’s answers and position in the flow after they close the tab and return later.
  3. Embeddables Cloud Context - This is the smallest subset of User Data that is stored in Embeddables’ databases. It is used for displaying analytics insights in the Embeddables Web App.

How to set whether/where a User Data property is stored

This feature is coming soon to the New Builder.

In the meantime, ask Embeddables support to show you how to set this in the component JSON.

Types of User Data

TypeExampleTypical Use-Case
Automatic Datacurrent_page_keySending the user’s current page to an API
AnswersweightAsking the user for their details
Computed FieldsbmiCalculating a value to decide if the user is eligible
Experiment Datasplit_title_lengthUsing the user’s current variant to show or hide a page
URL Paramsutm_sourceSetting a condition based on the user’s traffic source
Registered Keysaccess_tokenStoring the result of an API request

User Data keys and key naming

You can read our full guide to best practices for naming keys in Embeddables here:

Naming keys correctly in Embeddables

Learn how to choose good names for component keys, Computed Fields and more.

Input component keys

Input components, i.e. components that collect data from the user, are special in that they store their data in the User Data.

This means that the key name you choose for an input component will also be the property key name for that field in the User Data.

For example, if you have an input component with the key name, the User Data will look like this:

{
  ...
  "name": "John Doe"
  ...
}

For this reason, it’s especially important to choose good key names for input components.

Choosing good key names

  • All keys must be in snake_case, meaning:
    • lowercase letters and underscores only
    • no numbers
    • no special characters
    • no spaces
    • no uppercase letters
  • All experiment keys must start with split_.

Input component keys, and other keys that end up in the User Data:

  • Should be short and descriptive (e.g. full_name).
  • Should describe the data it’s collecting, not the component (e.g. full_name not full_name_input).
  • Should be unique within the Embeddable, except in very special cases (see below).

Keeping keys unique

All keys, whether component keys or other User Data keys, must be unique within the Embeddable.

The only exception to this rule is if you’re handling multiple input components that will be ‘swapped out’ - i.e. shown/hidden such that only one of them is visible at a time.

The most common use-case of this is a Split Test, e.g. testing between two different email capture pages, both containing an input component with the key email.