Variables in Pollarix
Variables allow you to personalize surveys, emails, and SMS messages with dynamic data. Use them to create more engaging, relevant experiences for your respondents.
Variable Categories
Quick Reference
| Category | Syntax | Scope | Example |
|---|---|---|---|
| System | {contact.*} | Everywhere | {contact.firstName} |
| Dynamic | {paramName} | Surveys & messages | {customerTier} |
| Workflow | {{params.*}} | Workflow config | {{params.apiToken}} |
Variable Types
- System Variables
- Dynamic Parameters
- Workflow Parameters
Built-in variables available everywhere:
| Variable | Description | Example Value |
|---|---|---|
{contact.firstName} | Contact's first name | "John" |
{contact.lastName} | Contact's last name | "Doe" |
{contact.email} | Contact's email | "john@example.com" |
{contact.phone} | Contact's phone | "+1234567890" |
{survey.title} | Survey title | "Customer Feedback" |
{collector.name} | Collector/Campaign name | "Q4 Campaign" |
{coupon.code} | Coupon code (if applicable) | "SAVE20" |
Configured per collector in the Dynamic Parameters tab:
Characteristics:
- Set once when the collector is created
- Available in surveys and messages
- Map survey fields to contact properties
Use cases:
- Pre-fill survey fields with contact data
- Calculate values based on survey responses
- Store custom data points per respondent
Setup:
- Open your collector
- Go to Dynamic Parameters tab
- Add parameter name and value mapping
Temporary variables created during workflow execution:
Sources:
- From HTTP responses (API calls)
- From Set Value steps
- Created manually for workflow logic
Key features:
- Discarded after each workflow run
- Can be made available in surveys by checking "In Survey"
- Use
{{params.parameterName}}syntax in workflow configurations
Workflow parameters only exist during execution. They are discarded when the workflow completes.
Trigger Timing
Understanding when triggers fire is critical for using variables correctly:
Trigger Comparison
| Trigger | When It Fires | Variables Available In |
|---|---|---|
| Contact Added | Before survey is sent | Surveys AND messages |
| Survey Opened | When user clicks link | Follow-up messages only |
| Survey Completed | After submission | Follow-up messages only |
Use Contact Added trigger for variables needed in surveys. Other triggers run after the survey is displayed.
Using Variables in Surveys
Making Workflow Variables Available
To use workflow parameters in survey questions:
- Use the "Contact Added" trigger (runs BEFORE the survey link is sent)
- Check the "In Survey" checkbox for the parameter
- Reference in survey using
{parameterName}syntax
- In Questions
- In HTML Blocks
- In Conditional Logic
Hello {contact.firstName}! Based on your tier ({customerTier}),
we have a special offer for you.
<div class="welcome">
<h2>Welcome, {contact.firstName}!</h2>
<p>Your loyalty points: <strong>{loyaltyScore}</strong></p>
</div>
// Show question only for VIP customers
visibleIf: "{customerTier} = 'VIP'"
// Show based on API-fetched credit score
visibleIf: "{creditScore} >= 700"
Using Variables in Messages
- Email Templates
- SMS Templates
- WhatsApp Templates
Dear {contact.firstName},
Thank you for your interest! Your personalized offer code is: {offerCode}
Best regards,
The {collector.name} Team
Hi {contact.firstName}! Your survey is ready: {survey.url}
Hello {contact.firstName}!
We'd love your feedback. Click here to take a quick survey: {survey.url}
Thank you!
Using Variables in Workflows
In workflow configurations, use double curly braces:
- In URLs
- In Headers
- In Request Body
https://api.example.com/customers/{{contact.id}}
https://crm.company.com/surveys/{{survey.id}}/responses
Authorization: Bearer {{params.apiToken}}
X-Customer-Tier: {{params.customerTier}}
{
"customerId": "{{contact.id}}",
"score": {{survey.score}},
"tier": "{{params.customerTier}}"
}
- Strings must be quoted:
"{{contact.email}}" - Numbers should not be quoted:
{{survey.score}} - Booleans should not be quoted:
{{params.isActive}}
Examples
Example 1: Personalized Survey with CRM Data
Goal: Show customer tier and personalized questions based on CRM data.
Setup:
- Add a Contact Added trigger to your workflow
- Add an HTTP Request step calling your CRM API
- Map responses:
$.tier→customerTier,$.score→loyaltyScore - Check "In Survey" for both parameters
In Survey:
Welcome back, {contact.firstName}!
As a {customerTier} member with {loyaltyScore} points,
you qualify for exclusive rewards.
Example 2: Dynamic Discount Based on API
Goal: Fetch personalized discount from pricing API before survey.
In Survey:
Great news! You're eligible for {discount}% off your next purchase.
Example 3: Post-Survey Coupon
Goal: Send coupon after survey completion.
In Email:
Thanks for the great feedback, {contact.firstName}!
Here's your reward: {coupon.code}
Best Practices
| Practice | Description |
|---|---|
| Use correct trigger | "Contact Added" for survey variables |
| Keep names simple | Use camelCase (e.g., customerTier) |
| Test with sample data | Before launching your collector |
| Document variables | In collector description for team reference |
| Handle missing data | Consider what happens if an API call fails |
| Use proper syntax | {var} in surveys, {{params.var}} in workflows |
Troubleshooting
Variables not appearing in survey
Common causes:
- Wrong trigger: Make sure you're using "Contact Added" trigger
- "In Survey" not checked: Ensure the checkbox is enabled for the parameter
- Timing issue: Other triggers run too late for survey variables
Solution: Review your workflow and ensure the trigger fires before the survey is displayed.
API data not available
Common causes:
- HTTP step error: Verify the URL and method are correct
- Response mapping wrong: Ensure JSON paths match your API response
- API failure: Review workflow execution logs for errors
Solution: Check the execution logs in your workflow for detailed error messages.
Variables showing as placeholders
Common causes:
- Wrong syntax: Use
{variableName}in surveys,{{params.variableName}}in workflows - Spelling error: Variable names are case-sensitive
- Variable not created: Ensure the parameter exists
Solution: Double-check your variable syntax and spelling.
Variables work in messages but not surveys
Common causes:
- Wrong trigger: Using "Survey Completed" instead of "Contact Added"
- "In Survey" not checked: Parameter not marked for survey access
Solution: Use "Contact Added" trigger and enable "In Survey" checkbox.
Next Steps
- Workflow Parameters - Deep dive into workflow parameters
- HTTP Requests - Learn to call external APIs
- Automations Overview - Build powerful workflows