How can I include the URL of the dynamic CMS page in the form data when users submit it?

Published on
September 22, 2023

To include the URL of the dynamic CMS page in the form data when users submit it, you can follow these steps in Webflow:

  1. Create a hidden input field in your form:
  • Open the Page where your form is located in the Designer view.
  • Drag and drop an HTML Embed element onto your form.
  • Double-click on the HTML Embed element to open its settings.
  • In the Code field, enter the following HTML code for the hidden input field:
    ```html

    ```
  • Save and close the settings.
  1. Add a custom attribute to your form submission button:
  • Select your form submission button in the Designer view.
  • Open the Settings panel on the right-hand side.
  • Scroll down to the Attributes section and click on the "+" button to add a custom attribute.
  • In the Attribute field, enter data-wf-page-url.
  • In the Value field, enter {{window.location.href}}.
  • Save your changes.
  1. Publish your site:
  • Go to the Webflow Designer toolbar.
  • Click on the Publish button to publish your site.

Now, when a user submits the form, the form data will include the URL of the dynamic CMS page. You can access this data using the form submission webhook integration or any other integration method you are using to handle form submissions.

Note: Depending on your specific use case, you may need to modify the code or adjust your form submission handling process accordingly.

By including the URL of the dynamic CMS page in the form data, you can:

  • Track the specific page from which the form was submitted for analytics or reporting purposes.
  • Distinguish form submissions coming from different pages in your CRM or database.
  • Personalize the follow-up emails or messages based on the page where the form was submitted.
  • Create dynamic redirects or actions based on the URL.

Now, you have successfully included the URL of the dynamic CMS page in the form data when users submit it. Happy form building!

Additional Questions

  1. How can I create a hidden input field in Webflow forms?
  2. What are the advantages of including the URL of the dynamic CMS page in form data?
  3. Can I customize the hidden input field code in Webflow forms?