Back to Blog

How to Track UTMs in Forms

Learn how to track UTM parameters in forms to gain insights into your marketing campaign performance and user behavior.

Posted by

Tracking UTMs in Forms

Why Track UTMs in Forms?

Tracking UTM parameters in forms helps you understand which marketing campaigns are driving form submissions, providing valuable insights into user behavior and campaign performance.

Implementing UTM Tracking in Forms

To track UTMs in forms, you need to capture the UTM parameters from the URL and include them in your form submissions. This can be done using JavaScript.

1. Capture UTM Parameters from the URL

Use JavaScript to parse the UTM parameters from the URL and store them in hidden form fields.

const urlParams = new URLSearchParams(window.location.search);
const utmSource = urlParams.get('utm_source');
document.querySelector(input[name="utm_source"]apos).value = utmSource;

2. Add Hidden Fields to Your Form

Add hidden fields to your form to hold the UTM parameters. These fields will be submitted along with the form data.

<form>
  <input type="hidden" name="utm_source" value="" />
  <input type="hidden" name="utm_medium" value="" />
  <input type="hidden" name="utm_campaign" value="" />
  <!-- Your other form fields -->
</form>

3. Submit the Form

When the form is submitted, the UTM parameters will be included in the submission data, allowing you to track the source of your form submissions in your CRM or analytics tool.

Alternatives

If you're not feeling up to the task of implementing this yourself, UTMHelper can automatically submit UTMs to your forms for full funnel tracking in your CRM. Create an account and simply add our snippet to your site and your forms will be automatically filled with UTMs.