If you embed your signup form on multiple webpages like a homepage, a contact page, and a product site, you may want to find out where subscribers signed up.
To do this, you'll edit your form to include a hidden field that pre-fills a webpage location value, like homepage or contact page. This value will appear in the profile of new subscribers from the embedded form. Later, you can use this location value to segment your audience and send targeted content to subscribers who came from a certain page.
In this article, you'll learn how to track signup locations with Mailchimp's embedded signup form.
Before you start
- Use the process described in this article only if you want more details about the page where embedded form subscribers are coming from. If you want to see how subscribers signed up, like through the hosted form, embedded form, or an integration like Facebook, segment your audience by signup source instead.
- This is an advanced feature and is recommended for users familiar with custom coding. Contact your developer or hire a Mailchimp Expert if you need assistance.
This is a multi-step process, and you'll need to complete these steps in order.
- Add a hidden text field to your signup form in Mailchimp.
- Copy the form's embed code.
- Edit the form for each webpage you want it to appear on.
After the form is updated and added to webpages on your site, you can test your form, and create auto-update segments to organize new subscribers by webpage signup location.
Add a hidden field
To get started, you'll add a hidden text field to your form.
- Click Audience.
- Click Audience dashboard.
- If you have more than one audience, click the Current audience drop-down and choose the one you want to work with.
- Click the Manage Audience drop-down and choose Signup forms.
- Select Form builder.
- Click the Forms and response emails drop-down menu, and choose Signup form.
- Navigate to the Build it tab.
- Look for the Add a field tab, and click Text.
- On the Field settings tab, input a Field name and Field tag.
- Under Field visibility, click Hidden.
- Click Save Field.
Now that you've added a hidden field to your form, you'll copy the form's embed code.
Get the embed code
To copy the form's embed code, follow these steps.
- From the Form Builder, click Signup forms.
- Select Embedded forms.
- Choose Classic, Condensed, Horizontal, or Unstyled from the form options.
- Under the Copy/paste onto your site heading, click the code to highlight your form. Use CTRL+C or CMD+C on your keyboard to copy it.
Before you post the embed form code on your site, you'll add one small piece of code into your form that will prefill the hidden field with the location information you provide.
Modify embed code
To modify the form code, follow these steps.
Paste the form code into a HTML or plain-text editor, and use CTRL+F or CMD+F on your keyboard to search for "form action." You'll find it near the beginning of your form's code. This is your form action URL, which will look similar to this example.
At the end of the code for your form action URL, add &MERGE=value. Replace MERGE with your hidden field's merge tag, and replace value with the form location information you'd like to send to Mailchimp. For example, to prefill the value Homepage in a hidden field called SIGNUP, add &SIGNUP=Homepage to the end of the form action URL.
- After you update the form, copy the code, and paste it onto your site.
Repeat steps 1-3 to edit additional copies of the code for each page where you want to embed the form.
Test your form
To test your updated signup form, fill it out completely on your site and submit it. If you've pasted the form in several places, use different email addresses for each test submission.
After you've confirmed your subscription, search Mailchimp for your contact profile, then find your hidden field's label and look for the value you used. If everything is set up correctly, your profile will have signup location information in this field.
Most people use data from prefilled hidden fields to create segments that track where subscribers came from. Create a segment to show all subscribers whose default merge tag value is "Homepage," "MarketingSite," or any other hidden text value you prefilled in your embedded forms. Remember, segments based on text fields are case-sensitive.
To keep track of signups from a specific page, save the segment. When new subscribers sign up on your embedded form, we'll automatically add them to the segment you created.