Skip to content

Embed Code

Generating an HTML embed code lets you display the first survey question directly inside your email template, making it easy for recipients to respond with just one click. This approach can help increase response rates by reducing friction for your users.

To create the embed code, open your survey in the editor and navigate to the “Embed Code” tab. From there, you can customize the settings, preview how the survey will appear in your email, and copy the code once you’re ready to add it to your email template.

When you change any settings, the embed code updates automatically. Once you’re happy with the configuration, simply copy and paste the code into your email template. The exact steps for adding HTML will depend on your Email Service Provider (ESP).

The HTML embed shows the first question when it is NPS, CSAT, a Rating Scale, or Multiple Choice. Any other first question, such as Open Text, is a “Take Survey” button.

Question headlines and descriptions are not included in the embed code, allowing you to recreate them directly within your email tool. This ensures that font styles and layout remain consistent with your email templates.

The generated code is plain HTML, so you can edit it in your email template as long as every survey URL stays intact. Customize HTML Embed Code covers what you can change.

You can choose the text and background color of the buttons in your embedded survey. When changing colors, you’ll see an updated survey preview on the right side of the screen.

By default, the colors come from the theme used by your survey (the Email Embed colors of the theme). If you change them here, keep in mind that they are reset to the theme’s colors whenever the theme is updated. To keep custom embed colors, create a theme with these colors instead.

Please note that the color selection only applies to the embed code you are using in your email. You also might want to adjust the colors of the survey page in the “Landing Page” tab.

The embed code buttons always use the same colors and have no dark mode variant. The survey landing page that opens after a click supports dark mode and follows the system settings of the respondent.

NPS and CSAT questions allow you to use a multicolor scale. If this option is enabled, the colors of the multicolor scale are used when generating the embed code.

As a next step, choose your Email Service Provider (ESP) from the list of supported providers.

Choosing an ESP will populate the “Identify User” field with matching user identification tags. These tags are then added to the HTML Embed Code to make sure that survey respondents are identified with their email address.

You can replace the suggested code with provider specific tags, for example if you want to use a different identifier or add additional data (see below).

If your email sending solution is not listed, don’t worry. You can still select “Other” and use our Email Surveys as described here.

If you are using our multilingual surveys feature, you’ll see the option to choose the language for the embed code. Choosing a language will translate labels and also determine the language used on the survey landing page.

The “Identify User” field allows you to import any kind of user data from your email tool to Refiner. When you select an Email Service Provider, the field already contains a code suggestion to identify survey respondents with their email address. You can further customize the code suggestion to import more data from your email tool to Refiner.

Depending on the capabilities of your email service provider, you might be able to access additional user traits (e.g. company name, subscription plan, …) that you want to import to Refiner. You can use the “Identify User” field (see above) to move data from your email service provider to Refiner.

What data you can import to Refiner depends on your email provider. Usually you’ll have access to data like the recipient name, their email address and custom fields that you created. You can check their documentation to figure out which data fields are available.

Add more parameters to “Identify User”, separated with “&”. A user trait uses the prefix contact_ and a field name, for example contact_company. The value is a personalization tag from your email provider, and that tag’s syntax depends on the provider.

Here is an example:

contact_email={{contact.email}}&contact_name={{contact.name}}&contact_company={{contact.company}}

You can also attach hidden data fields to the survey response. You can either import dynamic data provided by your email service provider, or static text data.

As with user traits, add more fields to “Identify User”, separated with “&”. Use the prefix response_ instead of contact_.

Here is an example:

contact_email={{contact.email}}&response_campaign={{campaign.id}}&response_touchpoint=post_checkout

Next to adding user traits and hidden response data, you can also add response tags using the “Identify User” field. The syntax for adding a tag is &tags=Tag1,Tag2,….

Here is an example:

contact_email={{contact.email}}&tags=Tag1,Tag2

By default, the HTML embed code uses the recipient’s email address as the contact identifier. Email addresses are usually unique to one person and are a reliable way to identify survey respondents.

If your email tool can insert the recipient’s user ID, you can use that ID instead.

Use the same identifier when you run Email Surveys and In-App Surveys (web or mobile) in the same environment. Refiner then keeps one record of each person’s survey activity.

Some data integrations, such as Segment, only match people when you send a user ID.

To identify respondents with their user ID, use contact_id instead of contact_email. The value after the equals sign is your email tool’s tag for that ID.

contact_id={{contact.user_id}}

The embed code is HTML around links to a hosted survey page. Each answer is one of those links.

You can change the HTML. As long as the URLs that point to the survey page stay intact, the survey keeps working.

A click on an answer saves it and opens the survey page at the second question, unless the click looks automated (see Capture data from the first click).

You can also change those URLs to pass user traits or contextual data, such as the campaign name. Personalize Survey Links lists the URL parameters.