How can I make the UTM script work for more than one form per page in Webflow?

Published on
September 22, 2023

To make the UTM script work for more than one form per page in Webflow, you can utilize custom code and Webflow's native form embed feature. Follow the steps below:

  1. Create a UTM script: Create a custom JavaScript function that extracts and stores UTM parameters from the URL. The extracted data should be saved to cookies or local storage, so it can be accessed on subsequent form submissions.

  2. Embed the form: In Webflow, design and setup your forms as per your requirements. Once you have completed the form layout, publish your site to get the form's HTML code.

  3. Integrate the UTM script: Insert the UTM script code just before the closing </body> tag in your Webflow project's custom code settings. This ensures that the script is loaded and ready to capture UTM parameters when the form is submitted.

  4. Modify the UTM script: Inside the UTM script, you will need to identify the form elements on the page and bind an event listener to each of them. This will capture the form submission and trigger the script to save the UTM parameters to cookies or local storage. Make sure you append the UTM parameters to the form's data before submitting it.

  5. Include form-specific identifiers: To distinguish between multiple forms, you can assign unique identifiers (e.g., IDs or CSS classes) to each form element on the page. This will help the UTM script target the correct form and append the UTM parameters to the respective form's data.

  6. Test and optimize: Test the functionality of the UTM script by submitting the forms with different UTM parameters. Check if the UTM parameters are correctly captured and stored in cookies or local storage. Optimize your script as needed.

By following these steps, you should be able to make the UTM script work for more than one form per page in Webflow. Remember to test the functionality thoroughly to ensure the data is captured accurately.

Additional Questions:

  1. How can I embed a form in Webflow?
  2. What are UTM parameters?
  3. How can I track form submissions in Webflow?