Assign events to existing contacts from mtc.js

Your software
My Mautic version is: 3.1
My PHP version is: 7.3.20-1
My Database type and version is: mysql Ver 15.1 Distrib 10.5.4-MariaDB

Your problem
My problem is:

I try assign and event to an existing contact, but the event is attached to an anonymous contact. My code is:

    (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', '', 'mt');

    mt('send', 'pageview', { id: [existing_id], email: '[existing_email]', name: 'XXXX', surname: 'XXX', phone: 'xxxx });

In fact, I’m able to see all these fields on the event.

These errors are showing in the log:

No error in the log.

Steps I have tried to fix the problem:

  1. Load a page with attached code.
  2. Go to Contacts view in Mautic.

Just an idea:
I had to fiddle with this when I was doing similar things.
(This is in custom fields.)

Good luck!

1 Like

Thank you @joeyk!

This was just what I’m missing :slight_smile: