A variable stands in for a piece of data that changes according to context. For example, if you wanted to greet each user that joins your course by name, you could place the variable that refers to the user's name into the text of your step, and the user will see their name wherever you see the variable in edit mode.

Variables for replacement strings

Add a replacement string to your text inside steps to greet each learner by name or sub in other specific data. 

There are user, step, and global variables available to use within content in any step. Add a string in edit mode, and then use preview mode to see how the string renders with real data. 

For example:

Hello {{ user.first_name }}, you are looking at "{{ step.name }}."

When viewed by Fred inside a step titled "Introduction," will read: 

Hello Fred, you are looking at "Introduction." 

Or, if you wanted to give learners a summary of their points so far in the course, you could do something like this:

"Complete this step to earn {{ step.userpoints_value }} points.

So far, you've earned {{ path.points.earned }} points out of {{ path.points.total }} points attempted, with a total of {{ path.points.total_points_possible }} points in the course."

Variables for passing parameters

These same variables can be used within a Typeform embed code to pass parameters to Typeform visible or hidden fields. For example:

<div>
  <div style="left: 0; width: 100%; height: 500px; position: relative;">
    <iframe
      src="https://jvnlwn.typeform.com/to/PWJjNj?step={{ step.name }}&email={{ user.email }}&first_name={{ user.first_name }}&last_name={{ user.last_name }}&link={{ window.location.href }}"
      style="border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;" allowfullscreen allow="autoplay; encrypted-media">
    </iframe>
  </div>
</div>

Note that the full step link is included using:

link={{ window.location.href }}

Query parameters should match Typeform hidden field names exactly.

Variables

Here's a master list of currently available, potentially useful scoped variables and their keys:

User

id
username
first_name
last_name
full_name
email
date_joined
display_name

Step

id
name
description
step_verb
userpoints_value
starts
due
time_to_complete
url

Path

points.earned 
points.total
points.total_points_possible

Cohort

id
name
access_starts
access_ends
enrollment_starts
enrollment_ends
description
url

Resource (Course)

id
name
description
short_description
cover_image
background_image
url
sum_registration_count

School (Pathwright Account)

name
url
subdomain
short_description
Did this answer your question?