Tracking script does not identify users

Your software
My Mautic version is: 5.0.4
My PHP version is: 8.1.28
My Database type and version is: pdo_mysql 5.7.44-48-log

Your problem
My problem is:
The tracking script for our external website no longer identifies leads, ever since upgrading to mautic 5.

Events fire correctly, and existing leads update their last_active information. However, new leads remain forever anonymous, with none of the custom information that we send across being acknowledged.

We add custom lead info via the script tag like so:

<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','https://mautic-url/mtc.js','mt');

    mt('send', 'pageview', {email: 'lead@email.com', firstname: 'name'} );
</script>

Here is an example of the event being recorded. This is me debugging through localhost.

And here’s the payload when the event call is firing:


(that’s just a disposable email I’ve used to test with)

Steps I have tried to fix the problem:

  • I’m debugging on incognito
  • Email and all other relevant fields are set as publicly updateable
  • There aren’t any logs in Mautic itself
  • I’ve set do_not_track to false just in case that would have anything to do with it.

One thing I’m not sure of is whether there’s a specific cron job or configuration that needs to be set up in order for this to work.

I’ve read through several posts where people are flagging the same issue and it seems that for some the publicly updateable toggle has fixed the problem but ours is definitely enabled.

Would be very grateful to anyone that could point me into the right direction with this!

1 Like

I’m experiencing the same issue. Did you find a solution for this?

Hello,

For tracking to work you need:

  1. SSL - otherwise Chrome won’T let you read out cookies
  2. Mautic to be installed on the same domain (with different subdomain is ok) and/or properly defined CORS settings.

You can check your Chrome Javascript console and see if there is a CORS error.

Joey

Hi Joey!

Thanks for your input on this. I’ve tested multiple scenarios without success. I’d appreciate any ideas the community might have.

The mt(ā€˜send’, ā€˜pageview’, { … }); event is correctly received. It creates an anonymous contact and adds the pageview to their history. I can see the ā€œemailā€ and ā€œfirstnameā€ data correctly listed inside the pageview event’s details.

However, the contact’s fields (email, firstname, etc.) are never populated from the tracking data. The ā€œContact Identified by Sourceā€ event is never triggered. This happens even though the fields are marked as ā€œPublicly updatableā€.

I set up a trial Mautic instance with Dropsolid and sent the exact same tracking data to it via a curl POST request, and it worked perfectly. I also tried with a fresh Mautic 6 instance, and it also worked perfectly.

In both instances, I followed the same steps: I updated CORS, marked the fields as publicly updatable, replayed the request, and the contact was successfully identified.

As a side note, is Mautic 6 generally considered stable enough for production workloads at this point? Perhaps I should consider that option.

Thanks for any pointers you can provide!

Hmm that is weird. It must relate to the environment?