Add the Current Page URL to a Webflow Form

Add a hidden pageurl field to your Webflow form to capture the page where someone submits it. Then check the value in your receiving system.
The same enquiry form can sit beneath twenty different articles. An email notification may tell you what the reader wants without telling you which page prompted the enquiry. A page-address field gives that conversation a useful starting point.
In this story4 sections
Add a named field inside the form
In your CMS Collection template, place a Code Embed inside the existing Form element, before its submit button. Add one hidden input to each form you want to label:
<input type="hidden" name="pageurl" data-page-url value="">
Keep the field name pageurl if an existing workflow already expects it. The data-page-url attribute gives the script a way to find the input without reusing an element ID across several forms. Do not put a second form element inside your existing one.
Do you need to hide the whole embed with CSS? No. The input’s hidden type already keeps that field out of the visible form. MDN’s hidden-input reference explains how its name and value travel with a form. Hidden does not mean secret: a visitor can inspect or edit the value.
Check that your site or Workspace supports Webflow’s Code Embed element before starting. Webflow warns that custom code can conflict with its functionality, so test your own form and integrations.
Fill the page address without replacing other load handlers
Add the following script once in the Footer code area for the relevant page or Collection template. Webflow’s custom-code documentation identifies the area before the closing body tag as a supported JavaScript location. Save and publish the relevant changes before testing the published form.
<script>
(() => {
function fillPageUrl(form) {
const pageUrl = window.location.origin + window.location.pathname;
form.querySelectorAll('input[type="hidden"][data-page-url]').forEach((field) => {
field.value = pageUrl;
});
}
function initialize() {
document.querySelectorAll('form').forEach(fillPageUrl);
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initialize, { once: true });
} else {
initialize();
}
document.addEventListener('submit', (event) => {
if (event.target instanceof HTMLFormElement) {
fillPageUrl(event.target);
}
}, true);
})();
</script>
The script fills the marked fields after the document becomes ready and refreshes the submitting form’s value during the submit event. The readiness check follows MDN’s DOMContentLoaded pattern. It uses event listeners rather than replacing window.onload, and does not cancel submission.
Why omit the query string and fragment? This example deliberately combines the origin and pathname, which MDN documents in its Location reference. It identifies the current page without automatically copying parameters or a fragment into a lead record. Review the path too if your URLs contain personal information.
If query parameters identify materially different content, decide which values you actually need before adapting the example. For campaign labels, our Webflow UTM guide treats campaign fields separately. This page-address field does not preserve a visitor’s original landing page across a browsing journey.
Check the value where the submission arrives
How do you know the setup worked? On an authorized staging page, submit a clearly marked test using data you are permitted to send. Inspect the hidden input in the browser first, then inspect the saved submission or destination record. Repeat from another CMS article and, if relevant, a second form on the page.
For forms configured to send to Webflow, its submission documentation points to Site settings, Forms. A custom action bypasses Webflow’s processing; third-party destinations need their own field mapping and verification. Do not assume a browser value will automatically become an email field, CRM property or export column.
What if pageurl arrives blank or is missing? Check that the input sits inside the intended form, has its name, remains enabled and carries the data-page-url attribute. Then check whether the script ran and whether your handler reads and maps that field. A handler that serializes data before the normal submit event needs its own integration check.
In our November 28, 2026 local Chrome check, the example populated two forms, a later-inserted form and a form submitted after a page-path change. It also worked when loaded after the document was ready. Those checks used local FormData; they did not establish Webflow, email or CRM delivery.
Use the page label for the question it answers
Can this identify your highest-converting article? It can help group received submissions by their submission page. To compare conversion rates, you also need a defined outcome and a comparable traffic denominator, as our conversion-rate guide explains.
The value remains a browser-supplied label, not proof of lead quality or the entire acquisition journey. If your next task is screening personal email addresses, use our Webflow email-filter guide alongside checks at the receiving system.





