# Updating mautic contact with details from WPForms form

**URL:** <https://forum.mautic.org/t/updating-mautic-contact-with-details-from-wpforms-form/31067>\
**Category:** Product Support\
**Created:** [February 26, 2024, 8:59pm UTC](https://forum.mautic.org/t/updating-mautic-contact-with-details-from-wpforms-form/31067 "2024-02-26T20:59:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![loki](https://avatars.discourse-cdn.com/v4/letter/l/3be4f8/32.png) [@loki](https://forum.mautic.org/u/loki)\
**Post date:** [February 26, 2024, 8:59pm UTC](https://forum.mautic.org/t/updating-mautic-contact-with-details-from-wpforms-form/31067/1 "2024-02-26T20:59:01Z")

</div>

I have mautic tracking anonymous users on my wordpress website using the wordpress plugin.

I’m attempting to get these anonymous contacts updated with email addresses when a user submits a WPForms form on the website but aren’t having much luck.

What I’ve tried;

Adding

```auto
<p>Thanks for contacting us! We will be in touch with you shortly.</p>
<p>&nbsp;</p>
<p><script>
    (function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n;
        w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t),
        m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m)
    })(window,document,'script','http://m.mydomain.com/mtc.js','mt');

    //mt('send', 'pageview');
    mt('send', 'pageview', {email: '{field_id="1"}', firstname: '{field_id="0"}' tags: 'Contact Form'} );	
</script></p>

```

to the confirmation message displayed by WPForms.

If I view the source code of the page after the form has been submitted the email and firstname of the `mt('send', 'pageview', {email: '{field_id="1"}', firstname: '{field_id="0"}' tags: 'Contact Form'} );` function contains the correct details but mautic doesn’t get updated.

I think the script probably isn’t running on the page? I’m not great with javascript, how do I get the script to execute? Or is it a different problem I’m running into?

I know I can (and maybe should) use a mautic form for this but I have to update a few and the WPForms form does it’s job at the moment.

---

<div class="post-metadata">

**Author:** ![loki](https://avatars.discourse-cdn.com/v4/letter/l/3be4f8/32.png) [@loki](https://forum.mautic.org/u/loki)\
**Post date:** [February 27, 2024, 12:44am UTC](https://forum.mautic.org/t/updating-mautic-contact-with-details-from-wpforms-form/31067/2 "2024-02-27T00:44:09Z")

</div>

If anybody else comes across this and wants to do something similar the problem was with the spacing (besides the missing comma above). It seems WPForms puts `<p></p>` tags in the way when there are line breaks which messed up the script. It’s working now.
