Skip to main content
All CollectionsIntegrations
How To Pre-Populate Form Fields On Quizzes
How To Pre-Populate Form Fields On Quizzes

Pre-populate email opt-in form on quizzes with customer data via the embed code.

Matthew Clark avatar
Written by Matthew Clark
Updated over 6 years ago

Customer data passed to the quiz will be automatically used to pre-populate the form fields in the opt-in form. If all form fields have been provided the opt-in form will be automatically submitted and not shown to the quiz taker.

Using the iFrame Embed Code

If you are using the iFrame embed code to embed your quiz on your website, you can pass existing customer data to the quiz using URL parameters.

You can append data to the end of the source URL of the iFrame using the following formula:

&user.field_id=field_value

For example, you could pass the value of a customer's email address and first name by appending the following string to the end of the source URL:

&user.email=example@tryinteract.com&user.first_name=John

Here is a list of acceptable field IDs that you can pass via the URL parameters:

  • Email Address - user.email

  • First Name - user.first_name

  • Last Name - user.last_name

  • Company Name - user.company

  • Phone Number - user.phone

  • Zip Code - user.zip

Putting all of these steps together, your iFrame embed code should now look like the following using the current example:

Using the Javascript Embed Code

If you are using the Javascript embed code to embed your quiz on your website, you can pass existing customer data to the quiz updating the user attribute in the options of the embed code.

You can add customer data to the user object in the Javascript embed code using the following formula:

user: { field_id: "field_name", ... }

For example, you could pass the value of customer's email address and first name by appending the following object attribute to the options object (more info on this below):

user: { email: "example@tryinteract.com", first_name: "John" }

Here is a list of acceptable field IDs that you can pass via the user object:

  • Email Address - email

  • First Name - first_name

  • Last Name - last_name

  • Company Name - company

  • Phone Number - phone

  • Zip Code - zip

Putting all of these steps together, your Javascript embed code should now look like the following using the current example:

Using the Promotions Embed Script

If you are using a popup or announcement bar on your website to promote your quiz on your website, you can pass existing customer data with a little tweaking of the embed script.

You can add customer data to the user object in the Javascript embed code using the following formula:

{ user: { field_id: "field_name", ... } }

For example, you could pass the value of customer's email address and first name by appending the following object attribute to the options object (more info on this below):

{ user: { email: "example@tryinteract.com", first_name: "John" } }

Here is a list of acceptable field IDs that you can pass via the user object:

  • Email Address - email

  • First Name - first_name

  • Last Name - last_name

  • Company Name - company

  • Phone Number - phone

  • Zip Code - zip

Putting all of these steps together, your Javascript embed code should now look like the following using the current example:

Frequently Asked Questions

When should I use the feature to pre-populate form fields?
โ€‹
If you have a website where you track your existing customers and have their contact info readily available (usually via tracking code), you can use this feature to prevent known users from having to re-enter their contact information on your Interact opt-in forms.
For example, if a user John is logged into your website and you already have access to his contact information, let's say an email address of john@example.com, you can pass this known data into your existing Interact quiz to automatically fill out the requested information in the opt-in form. This is helpful because the user feels like they aren't providing their info all over again if they have already done so elsewhere on your website.

Will this prevent the opt-in form from being shown to my users?
If you pass in all of the required information that is requested on your opt-in form, the opt-in form will not be shown to the user. It is important to note that although the opt-in form is not being shown to the user, it does still submit the form and run any automations you have set up.
For example, if you have an Interact opt-in form that requires First Name and Email Address, and you pass the data John (First Name) and john@example.com (Email), all fields are complete and the opt-in form will not be shown to the user.

Form fields are still not being updated with the data I am passing in, what can I do?
โ€‹
Many of the issues with this feature come from the step where you are writing code to pre-populate the contact information. It should be noted that this is an advanced feature and should only be attempted by your website administrator or someone who has direct access to your website scripts.
One common misconception is that the contact information of your users can be automatically pulled from the browser or by our app. However, the contact information of your users must already be known by your website and stored in a way that is accessible to be passed via URL parameters or Javascript.

Did this answer your question?