# Use tokens for the value of hidden fields in forms

**URL:** <https://forum.mautic.org/t/use-tokens-for-the-value-of-hidden-fields-in-forms/3820>\
**Category:** Ideas and Feature Requests\
**Created:** [May 19, 2016, 11:36pm UTC](https://forum.mautic.org/t/use-tokens-for-the-value-of-hidden-fields-in-forms/3820 "2016-05-19T23:36:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hailong](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/hailong/32/71_2.png) [@hailong](https://forum.mautic.org/u/hailong)\
**Post date:** [May 19, 2016, 11:36pm UTC](https://forum.mautic.org/t/use-tokens-for-the-value-of-hidden-fields-in-forms/3820/1 "2016-05-19T23:36:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![hailong](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/hailong/32/71_2.png) [@hailong](https://forum.mautic.org/u/hailong)\
**Post date:** [May 19, 2016, 11:36pm UTC](https://forum.mautic.org/t/use-tokens-for-the-value-of-hidden-fields-in-forms/3820/2 "2016-05-19T23:36:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![martinstrom](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/martinstrom/32/433_2.png) [@martinstrom](https://forum.mautic.org/u/martinstrom)\
**Post date:** [June 16, 2016, 7:35pm UTC](https://forum.mautic.org/t/use-tokens-for-the-value-of-hidden-fields-in-forms/3820/3 "2016-06-16T19:35:20Z")

</div>

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](https://wordpress.org/plugins/url-params/) to populate the Mautic fields with the utm tags.  
I will record a video soon to explain my setup.

---

<div class="post-metadata">

**Author:** ![mbrinson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mbrinson/32/116_2.png) [@mbrinson](https://forum.mautic.org/u/mbrinson)\
**Post date:** [February 14, 2017, 9:07pm UTC](https://forum.mautic.org/t/use-tokens-for-the-value-of-hidden-fields-in-forms/3820/4 "2017-02-14T21:07:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![coachesmaven](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/coachesmaven/32/234_2.png) [@coachesmaven](https://forum.mautic.org/u/coachesmaven)\
**Post date:** [October 31, 2017, 1:54pm UTC](https://forum.mautic.org/t/use-tokens-for-the-value-of-hidden-fields-in-forms/3820/5 "2017-10-31T13:54:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![zenzozen](https://avatars.discourse-cdn.com/v4/letter/z/0ea827/32.png) [@zenzozen](https://forum.mautic.org/u/zenzozen)\
**Post date:** [November 14, 2017, 1:06am UTC](https://forum.mautic.org/t/use-tokens-for-the-value-of-hidden-fields-in-forms/3820/6 "2017-11-14T01:06:13Z")

</div>

@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” /]

---

<div class="post-metadata">

**Author:** ![petertl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/petertl/32/511_2.png) [@petertl](https://forum.mautic.org/u/petertl)\
**Post date:** [November 14, 2017, 1:11pm UTC](https://forum.mautic.org/t/use-tokens-for-the-value-of-hidden-fields-in-forms/3820/7 "2017-11-14T13:11:36Z")

</div>

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.
