I’ve been encountering an issue with my Mautic setup where I’m attempting to identify users and associate specific URL parameters (in this case, ‘email’) with contact attributes.
Here’s the code I’ve been using:
(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://mydomain.com/mtc.js','mt');
var urlParams = new URLSearchParams(window.location.search);
var email = urlParams.get('email');
var pageParams = {};
if (email) pageParams.email = email;
if (Object.keys(pageParams).length > 0) {
mt('send', 'pageview', pageParams);
} else {
mt('send', 'pageview');
}
Despite using this script, Mautic is not associating the ‘email’ URL parameter with the contact’s attributes as I would expect. I have ensured that the ‘email’ field exists in Mautic and matches the case of the parameter I’m passing.
Additionally, I’ve attempted to test this on different devices and outside of my Mautic browser session, but I have encountered the same problem on all of them.
Could you please provide some assistance or point me in the right direction to resolve this issue?
Not sure if this is related - but I have a similar problem: Updating contact via /mtc/event - #7 by dirk_s it looks like those mechanisms (via tracking JS) only rely on the identity stored in the cookie. It would indeed be good to use it as well for manually setting the concerned ID via parameter - instead of the cookie.
Who knows if this is it, but I came across your post in my hair pulling search…
If you are logged into mautic on your machine and also trying to track yourself in the same browser… Mautic WILL NOT UPDATE your user. You need to use an incognito tab to test.