How can I include UTM parameter data in my Webflow form submission to track sources like social media and Google?

TL;DR
  • Add a custom script in Webflow's Custom Code section to capture UTM parameters from the URL and store them in cookies or local storage.
  • Create hidden fields in your Webflow form to hold UTM parameter data and ensure their IDs match the parameter names.
  • Use JavaScript to populate hidden fields with UTM data from cookies or local storage when the page loads.
  • Test the form by submitting it with UTM parameters in the URL and verify if the UTM data is correctly included in form submissions.

If you want to track UTM parameters in your Webflow form submissions, you'll need to capture these parameters and include them when the form is submitted. Here's how you can do it:

1. Use Custom Code to Capture UTM Parameters

  • Access your Webflow project settings and go to the Custom Code section.
  • Add the script in the Footer Code section that detects UTM parameters (e.g., utm_sourceutm_mediumutm_campaign) from the URL and stores them in cookies or local storage.

2. Create Hidden Fields in Webflow Form

  • In your Webflow form, add hidden input fields for each UTM parameter you want to track (e.g., hidden-utm-sourcehidden-utm-mediumhidden-utm-campaign).
  • Set the ID of these fields to match the parameter names for easy reference.

3. Populate Hidden Fields with UTM Data

  • Use JavaScript (added in the Custom Code section or embedded on the page) to retrieve UTM data from cookies or local storage when the page loads.
  • Set the value of each hidden input field in the form with the corresponding UTM data.

4. Test Your Form Submission

  • Publish your site and test the form by visiting your site URL with UTM parameters (e.g., ?utmsource=facebook&utmmedium=cpc).
  • Submit a form and check the submissions in Webflow to ensure that the UTM data is included.

Summary

To track UTM parameters in Webflow form submissions, capture the parameters using custom JavaScript, and store them in cookies or local storage. Then, populate hidden form fields with these values before the form is submitted. This allows you to include the UTM tracking data with each form submission, providing insights into the sources and mediums that drive traffic to your site.

Rate this answer

Other Webflow Questions