Getting the form page url in the form results

Hey hope you doing well,

I have created a form in mautic and i try to save the url of the form as i put them on different sites and different pages on each site.

I found that this page that explain how to do that:

It seems like that tutorial is a bit old, the way to do it is a bit messy when you create a lot of forms and if i use the form more than once on the page it seems like it doesn’t work well and i wasn’t able to find a way to make it work via the form.

Isn’t there a simpler way to get the form page url and the domain url on the form submission?

It seems like it’s one of the most important data and it seems like mautic store that data on the form event in the user so i thought i will check if there is better way?

Thanks

At the moment the best way i found to deal with that is by adding mautic_refferring_page and using this code with the form (works for more than one form at the same page)

If anyone know a better way to do that using the system please share it

<script>
var mautic_refferring_page = document.getElementsByClassName('mautic_refferring_page');
for (var i = 0; i < mautic_refferring_page.length; ++i) {
    var item = mautic_refferring_page[i];  
    item.value = document.URL;
}
</script>