Currently, when a customer sends us an enquiry via a form, we only receive the content of the enquiry. I would like to be able to associate it with the user’s previous activity on our website.
I have an idea:
Mautic tracks every user who accesses our website (if they accept cookies). As long as they don’t leave their email address - this is only anonymous data and doesn’t appear in the contact list in Mautic.
I can’t embed a Mautic form on my website, but I can rewrite an existing form to send selected data directly to Mautic via the API.
This is where the problem arises - how does Mautic know which anonymous user to assign the form data to? I will probably have to use cookie data - we have access to this:
mautic_device_id
mtc_id
mtc_sid
I guess I need to send the mtc_id parameter via the API? How exactly should I send it so that Mautic interprets it correctly and creates a new contact with form data + historical activity data for that user?
Will this even work the way I think it should?
Or does it have to be done in a completely different way?
The other option would not be an API call (afaik there is no form submission via API!) but simply an HTTP request with the full form data (client-side via JavaScript, and thus carrying the required cookies).
→ Non-developer opinion, though
Yes Ekke’s solution above is the first step I would use.
However, there is an issue with posting to a mautic form from another form including the mautic ID: it doesn’t work (there are multiple threads.)
We solved this the following way:
Make the copy of the form in Mautic side with the same fields.
When the contact submits the form, read the mtc_id to identify the contact id in Mautic.
Make an API call to assign the email address to this anon contact. (Contact will be identified and previous history preserved.)
Post the form content via POST using the library mentioned by Ekke. Since the contact has an email address, no new contact will be created.