- Use clear and specific variable names
- Use Autocapture variables for conversational data
- Use Global variables for values needed across multiple steps
- Use Sensitive variables for confidential information
- Use metavariables for environment and channel context
- Minimize the size of stored data
- Avoid re-asking for information unnecessarily
- Use metadata for logged-in user information
- Test variable behavior with different user identities
- Keep your variable set organized
- Common mistakes
- Examples
- See also
Best practices
Variables are essential for creating dynamic, personalized, and context-aware experiences. They allow your AI Agent to collect information from users, track conversation state, and pass data into elements like Action and Playbooks. This topic outlines best practices for designing, storing, and reusing variables effectively, along with common pitfalls and examples of good variable usage.
Use clear and specific variable names
Choose names that describe what the variable stores, rather than generic labels. Clear naming helps both the AI Agent and future builders understand the variable’s purpose.
Good examples
user_emailshipping_addressaccount_tier
Avoid
valueinput1temp
Use Autocapture variables for conversational data
Autocapture variables perform best when the information is something the user will naturally state during the conversation (such as email, phone number, or order number).
Use Autocapture when:
- The target value will appear in the transcript
- The context is natural (e.g., “My order number is 12345”)
- You want the Agent to prompt only when needed
Avoid Autocapture when:
- The user might phrase the answer ambiguously
- The information needs precise formatting
Use Global variables for values needed across multiple steps
Global variables persist and can be reused across Actions, Playbooks, Processes, and other elements.
They are ideal for:
- Persistent user details (e.g., order number)
- Context used across multiple steps
Avoid storing:
- Large API responses
- Data that changes frequently
- Sensitive details that do not need to persist
Use Sensitive variables for confidential information
Sensitive variables should be used for personally identifiable or sensitive data.
Sensitive variables:
- Are redacted in the dashboard
- Are deleted automatically after 24 hours
- Should be used for anything you do not want stored long-term
Use metavariables for environment and channel context
Metavariables give your Agent information about the user’s device, browser, channel, and system state.
Common use cases:
- Personalizing content based on language or timezone
- Handling browser-specific behavior
Metavariables cannot be created manually. They are populated automatically or passed via setMetaFields() in your embed script.
Minimize the size of stored data
Variables can store up to 100,000 characters, but smaller values are better for performance and maintainability.
Best practices:
- Store only the specific fields you need
- Avoid storing large JSON responses
- Parse and extract needed values before saving
Avoid re-asking for information unnecessarily
Before using a Capture block, check whether the value already exists.
Use Set Variable or Conditional block to:
- Skip asking for information that has already been collected
- Reuse verified data
- Reduce friction and create smoother conversations
Use metadata for logged-in user information
Avoid asking users to repeat information that your system already knows. Use setMetaFields() to pass things like:
- email address
- account tier
- subscription level
This ensures consistency and reduces effort for authenticated users.
Test variable behavior with different user identities
Variable persistence depends on how Ada recognizes users. Test with:
- Returning Web Chat users
- New private-mode sessions
- Different devices and browsers
- Email threads inside and outside the continuation window
- Social channel interactions
Keep your variable set organized
Variable sets can grow over time! Keep them clean by:
- Reviewing unused variables periodically
- Maintaining clear descriptions
- Grouping variables by use case
- Standardizing naming conventions
Common mistakes
Here are some common errors that can impact performance or user experience.
Storing too much data
Variables that store entire API responses or large JSON objects may exceed the character limit or become difficult to work with.
Relying too heavily on Autocapture
Autocapture may misinterpret ambiguous inputs or fail in non-English languages.
Using Global variables for sensitive data
Sensitive details should be stored only in Sensitive variables.
Assuming variables always persist
Variable reuse depends on identity, channel rules, and persistence settings. A new user session may clear Global variable values.
Examples
Store only the fields you need
Correct
Avoid
Store only the fields you actually intend to use.
Use setMetaFields for logged-in users
Correct
Avoid Asking the user: “What is your email address?” for authenticated sessions.
Check before asking
Correct
If user_email exists, no need to capture it in a variable.
Avoid Asking the user for their email every time the process runs.