The simplest way how to submit a form data to Mautic

Update: since Mautic changed its primary tracking param from IP to cookie, the script below won’t merge the form submission with the current contact. I prepared a new PHP library which works with the cookie too.

John Linhart
2 min readJul 16, 2015

Update 2: If anyone would be interested in jQuery integration of this functionality, here you go.

In case you have your existing web app on one hand and the new marketing automation platform Mautic on the other and you want Mautic to track your form submissions, read on.

The simplest way would be to switch to Mautic Forms. Mautic lets you create many different forms which you can embed to your web app.

But that’s not the option if there is some other functionality behind your app forms and you still want Mautic to track your form submissions. There is quite a simple way how to do that.

The trick is to add another method to your script which handle the current form submission. That method takes the form data and sends them to Mautic as well.

The method can look like the following example:

You may notice that you still need a Mautic Form ID. So you have to create the Mautic Form where you’ll send the data to. It has to have the fields named the same as your form.

Also, your server has to have CURL extension allowed.

Notice that the third param is the IP address. If you want Mautic to merge the form data with an existing lead with the same IP address, this should do the trick. Otherwise Mautic will track your server IP address and in this case you might want to switch the Mautic Form to the Kiosk Mode.

Example usage:

pushMauticForm($_REQUEST, 3);// $_REQUEST can look like:
// array('email' => 'test@email.com', 'message' => 'Test message')

Your Mautic Form with ID = 3 then has to have fields called email and message.

--

--