Capturing form's page name

Hi team!



I’m using a mautic form in multiple pages in my website and I need to capture the page name where the form was submited.



I guess that I need to place a hidden field in the form, but I don’t know what token must I place as value, would you help me?



Thanks!

Hi team!

I’m using a mautic form in multiple pages in my website and I need to capture the page name where the form was submited.

I guess that I need to place a hidden field in the form, but I don’t know what token must I place as value, would you help me?

Thanks!

Probably the best way to do this would be as you suggest with a hidden field. It will depend on what platform your website is built on to determine what the value of that field should be. Are you using a common one? Most CMS have a variable for page title. Then you’ll simply need to have a custom field in Mautic to collect that value.

Hope that helps!
David

Yes David, I’m using WP with WPMautic plugin so it should be easy…

But I don’t know what to put in the hidden field to collect the title, I guessed that it would be a token like {page-title} or {embed_post:post_title} but it doesn’t work.

Any help would be appreciated!
R.

Awesome! Yeah, so here’s the thing, it will take a bit of code unless you can run php code from within your wordpress post content directly (I think there’s a plugin for that). Otherwise you’ll need to modify the WPMautic plugin to enable an interpretation of the variable. In PHP you can use <?php echo get_the_title( $ID ); ?> to get the title of the page. Then you’d set that to the value for your custom field. It’s a bit tricky but let me know if that makes some kind of sense. :slight_smile:

  • David

Hi @dbhurley! It has sense and I’ve tried it, now I’m able to run PHP code in pages and I can get the tittle of the page throw a token or shortcode like [insert_php]echo get_the_title( $ID );[/insert_php]

But it can’t be placed as a default value for a field form because the shortcode is not interpreted…

How must manage that to get the value in a form field?

Probably I 'm missing anything from your explanation.

Thanks!