# How to pass URL parameters to a form

**URL:** <https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315>\
**Category:** Product Support\
**Created:** [July 21, 2020, 3:11pm UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315 "2020-07-21T15:11:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![baffit](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/baffit/32/2806_2.png) [@baffit](https://forum.mautic.org/u/baffit)\
**Post date:** [July 21, 2020, 3:11pm UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/1 "2020-07-21T15:11:45Z")

</div>

> [@](#):
>
> [**View in #general on Slack**](https://slack.com/archives/C02GEN0SG/p1595343919290200)
> 
> ![Johannes_Hamman](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/6/6825224161f4f691078d8ec2693f950f74f3864c.png) **@Johannes\_Hamman:** i’ve spent hours looking for a solution to that url parameter and pass that into the form as the value to input e.g.  
> [http://mysite.com/landingpage?email=me@mysite.com&custom=uniquevalue](http://mysite.com/landingpage?email=me@mysite.com&custom=uniquevalue)  
> need this to pass into the form they submit  
> I can get everything to work , except the url parameters being passed  
> I followed this guide [https://docs.mautic.org/en/components/forms/managing-forms#pre-populate-a-form-field-value](https://docs.mautic.org/en/components/forms/managing-forms#pre-populate-a-form-field-value) but either i’m missing something or this is not working

---

<div class="post-metadata">

**Author:** ![baffit](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/baffit/32/2806_2.png) [@baffit](https://forum.mautic.org/u/baffit)\
**Post date:** [July 21, 2020, 4:56pm UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/2 "2020-07-21T16:56:52Z")

</div>

Does anybody have a guide on how this works?  
Even very basic, but prefer in video  
Just need to see how this works, then hopefully can figure out where I’m going wrong  
btw prefer v3.0.1 but also have v2.16.3

---

<div class="post-metadata">

**Author:** ![m.abumusa](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/m.abumusa/32/741_2.png) [@m.abumusa](https://forum.mautic.org/u/m.abumusa)\
**Post date:** [July 21, 2020, 5:44pm UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/3 "2020-07-21T17:44:55Z")

</div>

I have done in the past, you need to write custom javascript code to collect the query string and load it into hidden values in the form

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [July 21, 2020, 6:03pm UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/4 "2020-07-21T18:03:42Z")

</div>

Hi

Have you created custom fields for the utm parameters ?

A few things:

1. When creating custom fields make sure to mark them as “Publicly Updatable”
2. In the form field, create your hidden fields you want to capture and make sure they are Behaviour -\> Auto Fill Data enabled.

This should work, if not give examples of your setups of custom fields and form fields.

Good luck

---

<div class="post-metadata">

**Author:** ![baffit](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/baffit/32/2806_2.png) [@baffit](https://forum.mautic.org/u/baffit)\
**Post date:** [July 22, 2020, 9:06am UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/5 "2020-07-22T09:06:38Z")

</div>

i’d need a script that works, i’ve not written javascript in 15 years, this seems to be the gap, other info i’d seen implied that mautic will automatically use the utm values if it matches what’s in the form, this seems such an obvious feature to have in mautic, is there not a step by step guide or a working example?

---

<div class="post-metadata">

**Author:** ![baffit](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/baffit/32/2806_2.png) [@baffit](https://forum.mautic.org/u/baffit)\
**Post date:** [July 22, 2020, 9:07am UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/6 "2020-07-22T09:07:55Z")

</div>

tried that, and i’m sure it’s a puzzle piece, but i need the box to see the picture, this seems such an obvious feature to have in mautic, is there not a step by step guide or a working example?

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [July 23, 2020, 6:46am UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/7 "2020-07-23T06:46:41Z")

</div>

I have the answer!!

I actually did this for a client not long ago and just slipped my mind.

What I did was create a report with Data Source: Forms Form Submissions and added in Referer.

---

<div class="post-metadata">

**Author:** ![baffit](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/baffit/32/2806_2.png) [@baffit](https://forum.mautic.org/u/baffit)\
**Post date:** [July 23, 2020, 10:28pm UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/8 "2020-07-23T22:28:12Z")

</div>

> [@mikew](#):
>
> a report with Data Source: Forms Form Submissions and added in Referer

Okay that’s at least the whole referer link with all the url parameters, did you find a way to strip those out or use them, separately?  
In my case one of those is a unique id from an old system and I’d like to populate that into a custom contact field.

---

<div class="post-metadata">

**Author:** ![timrichardson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/timrichardson/32/2989_2.png) [@timrichardson](https://forum.mautic.org/u/timrichardson)\
**Post date:** [August 3, 2017, 1:30pm UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/9 "2017-08-03T13:30:09Z")

</div>

I’ve made an email, that has a link to a form, I want the forms email field to auto-populate.  
  
  
  
So, I’ve got a Mautic Form set up, Check.  
  
I’ve set the email field to auto-populate, Check  
  
I’ve got the Mautic Form on a Mautic landing page, Check.  
  
I’ve set up a contact to send emails to, where the data can be pulled from, Check.  
  
  
  
I’ve got the query string URL for the email, linking to the landing page, that should pull the email across and auto-populate the Email field, however, everytime I test, it never does.  
  
  
  
I’ve checked the URL and it does pull the email address into the link URL, so I’m not sure why it’s not working, can anyone see what I’m doing wrong?

---

<div class="post-metadata">

**Author:** ![timrichardson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/timrichardson/32/2989_2.png) [@timrichardson](https://forum.mautic.org/u/timrichardson)\
**Post date:** [August 3, 2017, 1:30pm UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/10 "2017-08-03T13:30:09Z")

</div>

I’ve made an email, that has a link to a form, I want the forms email field to auto-populate.

So, I’ve got a Mautic Form set up, Check.  
I’ve set the email field to auto-populate, Check  
I’ve got the Mautic Form on a Mautic landing page, Check.  
I’ve set up a contact to send emails to, where the data can be pulled from, Check.

I’ve got the query string URL for the email, linking to the landing page, that should pull the email across and auto-populate the Email field, however, everytime I test, it never does.

I’ve checked the URL and it does pull the email address into the link URL, so I’m not sure why it’s not working, can anyone see what I’m doing wrong?

---

<div class="post-metadata">

**Author:** ![timrichardson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/timrichardson/32/2989_2.png) [@timrichardson](https://forum.mautic.org/u/timrichardson)\
**Post date:** [August 3, 2017, 3:39pm UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/11 "2017-08-03T15:39:18Z")

</div>

Ok, so, we’ve custom coded a bit of a workaround for this, now we have the issue of when we add the shortcodes:

`
{pagelink=5}&Name={leadfield=firstname|true}&Email={leadfield=email|true}`

Into an email button, it strips away the name and email fields, so it looks like this

[page URL]?ct=YTo0OntzOjY6InNvdXJjZSI7YTowOnt9czo1OiJlbWFpbCI7TjtzOjQ6InN0YXQiO3M6MTM6IjU5ODM1MDAwZTc0NjEiO3M6NDoibGVhZCI7aToyMzc7fQ%3D%3D&Name=&Email=

Rather than

[page URL]?ct=YTo0OntzOjY6InNvdXJjZSI7YTowOnt9czo1OiJlbWFpbCI7TjtzOjQ6InN0YXQiO3M6MTM6IjU5ODM1MDAwZTc0NjEiO3M6NDoibGVhZCI7aToyMzc7fQ%3D%3D&Name=timrichardson&Email=timrichardson%[40example.com](http://40example.com)

Anyone else had this issue?

---

<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:** [August 4, 2017, 8:26am UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/12 "2017-08-04T08:26:17Z")

</div>

I am not sure but I think I encountered this in the past. Please try the following:

- remove the “true” behind the email parameter
- add a dummy parameter (e.g. …?test=test&name=…) in the first position

---

<div class="post-metadata">

**Author:** ![ninjoan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ninjoan/32/1005_2.png) [@ninjoan](https://forum.mautic.org/u/ninjoan)\
**Post date:** [August 4, 2017, 7:30pm UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/13 "2017-08-04T19:30:22Z")

</div>

Have you enable the option autofill field on the form?

---

<div class="post-metadata">

**Author:** ![robm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/robm/32/260_2.png) [@robm](https://forum.mautic.org/u/robm)\
**Post date:** [February 5, 2018, 5:40am UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/14 "2018-02-05T05:40:07Z")

</div>

I wanted to know how to send a link in an email from Mautic to a contact. That link is to a form on a landing page, and I wanted that form to already have the person’s email address pre populated so they will not have to fill it in. There are instructions in the docs but they are more complicated than they need to be.

Here is what you do.

1. Create the form make sure to add the email field. This can be a hidden field but I used a visible field so I could see if it was pre populating right in the form.
2. Set the email behaviour to auto fill and show if it exists.
3. Finish setting up your form
4. Go to the gear icon top right and open custom fields.
5. Look for the email field and click on it.
6. Flick the switch to make the email field publicly editable.
7. Create a landing page and add the form you have created.
8. Create the email that conatins the link to the landing page that holds the form.
9. When creating the link you need to add [https://url](https://url) of the landing page with the form?email={leadfield=email|true}
10. The `?email={leadfield=email|true}` is the key and must be addend to the end of the landing page url. No space, no / between the end of the url and the ?
11. test in incognito mode while completely logged out of mautic.

This worked for me. In theory you could pass any mautic field using the same logic and just changing the lead filed or contact filed in question.

Hope it helps someone else.

This has been a guide for idiots like me.

---

<div class="post-metadata">

**Author:** ![bizcrony](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bizcrony/32/409_2.png) [@bizcrony](https://forum.mautic.org/u/bizcrony)\
**Post date:** [February 12, 2018, 2:28am UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/15 "2018-02-12T02:28:25Z")

</div>

Use HTML code

---

<div class="post-metadata">

**Author:** ![amoreno](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/amoreno/32/580_2.png) [@amoreno](https://forum.mautic.org/u/amoreno)\
**Post date:** [January 16, 2020, 9:17am UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/16 "2020-01-16T09:17:15Z")

</div>

Well, seems that i´m an idiot too. 😁  
Thanks a lot for your quick tutorial!

All the best, Alvaro

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [July 29, 2020, 7:59am UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/17 "2020-07-29T07:59:05Z")

</div>

Merged a bunch of threads into this one - a documentation update is in the works to make this clearer!

---

<div class="post-metadata">

**Author:** ![namratasaun](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/namratasaun/32/2801_2.png) [@namratasaun](https://forum.mautic.org/u/namratasaun)\
**Post date:** [May 5, 2021, 2:54pm UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/18 "2021-05-05T14:54:38Z")

</div>

I tried this and I do get email appended to the url but the field is not getting populated.

https://{your mautic domain name}/{your mautic landing page name}?email={email of the user}

is this the correct url?  
where to put form tho as mentioned in 9th step

-------worked-------  
In incognito mode.

Any idea how can I use this on unsubscribe?  
I tried using the “Unsubscribe Feedback Form” part, but there is no feature to autofill email directly from form

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [May 5, 2021, 6:28pm UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/19 "2021-05-05T18:28:16Z")

</div>

Hey @namratasaun - I think the reason it might have worked is that you did it in incognito mode and maybe you were testing on the browser you were logged into Mautic.

I too had this issue and wrote a [blog post](https://surge.media/auto-populating-a-mautic-form-with-information/) on it.

For unsubscribe have you tried using dynamic content to populate the e-mail field ? It can be assumed that the person is obviously unsubscribing from an email this he will be tracked and dynamic content should pull through the email address.

---

<div class="post-metadata">

**Author:** ![namratasaun](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/namratasaun/32/2801_2.png) [@namratasaun](https://forum.mautic.org/u/namratasaun)\
**Post date:** [May 6, 2021, 5:05am UTC](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315/20 "2021-05-06T05:05:07Z")

</div>

> [@mikew](#):
>
> field

Yes, it worked in incognito mode.

I am not really sure about how we can do it through dynamic content?  
Can you help me out?

Want something of this sort

 ![Screenshot 2021-05-06 at 12.53.32 PM](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/2/2ab58eb9e260d973b2e32c0496044b3eeef161b4.jpeg)

the email is prefetched and the user just have to select reason for unsubscribe.

[Next page](https://forum.mautic.org/t/how-to-pass-url-parameters-to-a-form/15315.md?page=2)
