Mautic Community Forums

How to pass URL parameters to a form

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

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

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

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?

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?

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.

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.

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?

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?

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

Anyone else had this issue?

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

Have you enable the option autofill field on the form?

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 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.

1 Like

Use HTML code

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

All the best, Alvaro

1 Like

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