Signup

Track embedded email clicks with Google Analytics (for advanced users)

When you embed your typeform in an email, respondents can answer the first question directly from your email. You can track which answer option has been clicked by respondents on the first question in your email, even if they don’t complete the form. You can achieve this by adding Hidden Fields to your typeform and integrating your form with Google Analytics. Follow the instructions below to learn how.

The Google Analytics integration is only available on a Business or above Typeform plan.

HC_Warning_ilu_cropped.png
Warning! This workaround involves editing a bit of code. If you’re not comfortable with editing some code, we recommend asking a developer colleague for help.

1. Create a form that starts with a question type that is compatible with launching directly in an email.

In our example, we’ll use a Yes/No question type.

track_email_click01.png

2. Add a Hidden Field to track which button a respondent clicks.

In our example, we want to track if customers are satisfied with their purchase so we’ll add a Hidden Field called satisfaction to track if they have selected Yes or No.

track_email_click02.png

3. Next, connect your typeform with Google Analytics.

track_email_click03.png

4. Next, we’ll need to grab the Embed in an email code. Head over to the Share panel and click Embed in an email > Start embedding > Copy.

track_email_click04.png

5. Head over to your email distribution application (we’re using Mailchimp) and create a new email. Add custom code to your email template and paste the Embed in an email code.

This part may vary depending on your email distribution application.

track_email_click05.png

HC_Note_new.png
Note! Launching your typeform from an email only works with email distribution applications like Mailchimp. Everyday email services such as Gmail, Outlook, or Yahoo! Mail do not support this kind of code.

6. Now, it’s time to edit the code before sending it off.

First, locate your form’s URL associated with each answer option in the code. You’ll see a <a> tag with a href attribute in the code for every answer option you have on the first question of your form.

In our example, we have 2 <a> tags with href attributes as our first question has 2 answer options. If you have 5 answer options on the first question of your form, you’ll see 5 <a> tags with href attributes.

Each <a> tag refers to an answer option button and contains your form’s URL (href). Below is an example of our <a> tags for the answer options Yes and No.

track_email_click06.png

HC_BobRoss_ilu_cropped.png
Tips! Use the Find command on your device to search for an answer option in the code to easily locate your <a> tags.

Next, we’ll edit the code by adding our Hidden Field with the answer option it’s associated with after the ? in the URL.

The URL for our answer option Yes looks like this:

track_email_click07.png

We’ll add our Hidden Field satisfaction=yes& after the ? in the URL and it should look like this:

track_email_click08.png

The URL for our answer option No looks like this:

track_email_click09.png

After adding the Hidden Field satisfaction=no& after the ?, it looks like this:

track_email_click10.png

Edit each <a> tag for all the answer options you have for the first question in your form, following the format from above.

7. Once you’ve edited the code, send the email to yourself to test it out. Remember, test responses count toward your response limit.

8. Head over to Google Analytics to see the data you’ve entered. Go to Reports > Engagement > Pages and screens and click the + sign.

If you’re using Google Analytics 360, where you locate your data might be slightly different from the images below. In our example, we’re using Google Analytics (free version) to locate our data.

track_email_click11.png

Then select Page/screen and click Landing page + query string.

track_email_click12.png

You’ll see query strings for each answer option you have for the first question in your form. The query string will contain the Hidden Field you’ve added with the answer option respondents have clicked.

In our example, respondents have clicked the answer option yes once and no once. Highlighted below is where you can see the Hidden Field and answer option respondents have clicked.

Google Analytics will only display query strings for answer options that have been clicked.

2023-04-03_10-51-31.png

HC_Note_new.png
Note! It can take up to 24 hours for Google Analytics to update, so you might have to wait to see the data.

Tap into our community knowledge