# Track which dynamic page a new Wix Form was submitted from

**URL:** <https://forum.wixstudio.com/t/track-which-dynamic-page-a-new-wix-form-was-submitted-from/71326>\
**Category:** Show and tell\
**Tags:** wix-forms-v2, wix-forms, code\
**Created:** [June 4, 2025, 1:45pm UTC](https://forum.wixstudio.com/t/track-which-dynamic-page-a-new-wix-form-was-submitted-from/71326 "2025-06-04T13:45:28Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![noahlovell](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/noahlovell/32/118920_2.png) [@noahlovell](https://forum.wixstudio.com/u/noahlovell)\
**Post date:** [June 4, 2025, 1:45pm UTC](https://forum.wixstudio.com/t/track-which-dynamic-page-a-new-wix-form-was-submitted-from/71326/1 "2025-06-04T13:45:28Z")

</div>

Sometimes, you want to know which page a user submitted a form on - which can be especially useful for dynamic pages like a car listing or product detail. This tutorial walks you through how to add that data to your form submission.

* * *

## **Setup**

### **Step 1: Add a Hidden Field**

1. Create a form with a hidden field, for example “Page Submitted”
2. Give it a Field key _(Found under the advanced tab)_. In this case `page_submitted`  
 ![This is a screenshot of new Wix Forms composer showing the addition of form fields, including email input and submission button options.](https://us1.discourse-cdn.com/wix/original/3X/1/8/1825910c482316c0783fcec850d7c8472fe57c94.jpeg)

> This field will still show in the form composer, but not on your live site.

* * *

### **Step 2: Add This Code**

Paste the following code into your page’s code panel:

```js
$w.onReady(function () {
    $w("#dynamicDataset").onReady(() => {
        let itemObj = $w("#dynamicDataset").getCurrentItem();

        let currentPage = itemObj["link-cars-make"];

        $w("#myForm").setFieldValues({
            page_submitted: currentPage
        });
    });
});

```

> Update the element IDs to work with the elements on your page

* * *

## **How It Works**

- `#dynamicDataset` is your dynamic pages dataset.
- `getCurrentItem()` pulls the content of the current item
- We extract a relevant value (in this case, the dynamic URL slug - `link-cars-make`)
- Then we populate that into the form using `setFieldValues()`

This value will now be stored in your form submission.

* * *

## **Customize It**

This setup is flexible! You can:

- Use any field from the dataset (e.g. `make`, `model`, `price`, etc.)
- Add multiple hidden fields
- Concatenate values into a single field for context
- Use information from other sources, such as UTM parameters

### **Examples**

**Concatenating multiple fields**

```js
let details = `${itemObj.make} ${itemObj.model}`;

$w("#myForm").setFieldValues({
  page_submitted: details
});

```

**Saving UTM parameters**

```js
let utmParams = await wixSiteLocation.location.query()

$w("#myForm").setFieldValues({
  utm_source: utmParams.utm_source
})

```

* * *

## **That’s It!**

You now have a form that tracks which item/page it was submitted from.

This is great for:

- Better submissions context
- Segmenting leads
- Triggering automations based on dynamic page info

Happy building!

---

_[View the full topic](https://forum.wixstudio.com/t/track-which-dynamic-page-a-new-wix-form-was-submitted-from/71326)._
