Mautic Woocomerce Tracking Question

Once again I know this has been written about in the past, however I am experiencing an issue where mautic is tracking the user coming in, I see all the page hits and everything on the anaymous user, the user then goes and makes a purchase, we are passing the information of the purchase through to Mautic using n8 using a simple web hood and creating a contact inside Mautic.

Outcome is the new user that is created has no history on it.

Any pointers ?

Yes,
What happens is:
You are rracking before purchase using the mautic tracking code, which uses the cookie. You create an anonimous contact.
Then you pull the Woocommerce purchase via N8N and push a NEW contant into Mautic. Why new? because you didn’t read out the cookie → lead id. N8N can’t do it.
You need to identify the contact on the Thank you page by adding the Email parameter to the contact tracking event.
After this N8N will update an existing contact.

Same issue with Shopify btw.

Hey @joeyk

Can you explain a bit more about this:

Blockquote
You need to identify the contact on the Thank you page by adding the Email parameter to the contact tracking event.

What do you mean by “adding the email parameter to the contact tracking event”. or how do I actually do this ?

Could I do this inside the Mautic tracking script in side the mt() something like this:
mt('send', 'pageview', {email:'$data['billing']['email']'});

how would I actually do this.

With N8N I can actually query the DB and get the last id of users, but this does not work really well if there is traffic on the site :slight_smile:

The other thing we have tried to do is using n8n we are also able to create the contact with an IP addesss but this does not merge the contacts and is also pretty dangerous

Yes you need to make the javascript call BEFORE the n8n trigger:

mt(‘send’, ‘pageview’, {email:‘emailaddress’});

You can see in the sourcecode of your page if the right email address is added.

how do I call the email address ? {email:‘emailaddress’}. or is this the exact syntax I use ?

From Javascript?

I guess :slight_smile:

You know me Joey a little less technical…