Injecting URL parameters into hidden a Wix-forms-v2 form

Question:
Is there a way to inject URL parameters into hidden form fields of a v2 form?

Product:
Wix Editor

What are you trying to achieve:
I’d like to collect information available in the unique URL on Submission Event

What have you already tried:
I’ve tried adding hidden fields on the page itself which were updated using some code, but couldn’t find any reference in the code that could be used to inject values into a v2 form.

I’m currently using the following Velo code to accomplish this.

import wixLocationFrontend from 'wix-location-frontend';

if ($w('#formElementId').rendered) {
        $w("formElementId").setFieldValues({
            fieldName: wixLocationFrontend.query['UrlParam'],
        });
    }

The only issue is if there are multiple pages where your form is being used. There could be a different elementId for each one. That’s why I’ve wrapped it in the if statement. I just repeat this code for however many variations I can find.