Using a Unique ID for Tracking Code

Hi,
Each collection document has an auto-generated ID (field key: _id ).
I don’t know which method you chose to use in order to submit the form, so I’ll so you how to do it with wixData.

//...import wixData, wixLocation, have $w.onready(), have an onClick event handler to submit, on submit collect the input values into an object then:
wixData.insert("FormCollectionName", object)
.then(obj => {
wixLocation.to("/thank-you?id=" + obj._id;
})
//...

In the thank you page script add at the beginning:

<script>
const urlParams = new URLSearchParams(window.location.search);
const id = urlParams.get("id");
</script>
//and use the id in the tracking code