Mautic Community Forums

Use tokens for the value of hidden fields in forms

I’d like to distinguish from where the users click the form. Suppose I use a unique query parameters in the url for each source, if we can read the parameter with a token, and set it as the default value of a hidden field, then I can see the “source” from the form results page clearly.



Does that make sense, or could anyone suggest a solution if there is?

I’d like to distinguish from where the users click the form. Suppose I use a unique query parameters in the url for each source, if we can read the parameter with a token, and set it as the default value of a hidden field, then I can see the “source” from the form results page clearly.

Does that make sense, or could anyone suggest a solution if there is?

I have actually successfully implement this into my Mautic, my form grabs the google utm tags from the url and puts them into some custom fields I have created in Mautic. This is really great because I can then create a report on these custom fields in Mautic and see what campaigns/urls is performing the best. I use wordpress together with a plugin called URL params to populate the Mautic fields with the utm tags.
I will record a video soon to explain my setup.

Hey martinstrom, did you ever get that video recorded? I’d be very interested in seeing your setup.

I’d be interested in seeing a video to explain as well.

@martinstrom can you please shre the solution?

This method doenst work because wordpress strips away the code within brackets:
<input type=“text” name=“firstname” [urlparam attr=“value” param=‘utm_source’]>

This method doenst work too because mautic uses [] to identify the field, so it causes the plugin to break the code:
[urlparam htmltag=“input” type=“text” name=“mauticform[utm_source]” attr=“value” param=“utm_source” /]

If you have a Mautic field which name is e.g. myfield1 und you create a URL like mautic.xy/mysite?myfield1=value then Mautic will automatically put the value into the input field. Important: it has to be a Mautic landing page.