Tracking Code & Shopify Not Matching up to Contacts

Your software
My Mautic version is: 2.16.3
My PHP version is: 7.2

Your problem
My problem is:
We have installed the tracking code on Shopify and enabled on Mautic side:
Identify visitor by tracking url
Identify visitor by device fingerprint
Identify visitors by IP

The problem is that we are able to track all visitors however it is not connecting them to the contacts.

I signed in as a user, see that I am signed in, however I do not see any Events under my contact.

Any pointers on how to even start debugging this.

These errors are showing in the log:

Steps I have tried to fix the problem:

Hi,
There are 2 things here:

  1. if you have the admin cookie in your browser, than you won’t be tracked. You need to delete that cookie first.

  2. If you imported the contacts, than they won’t get tracked automatically, Mautic needs to make the connection. This is usually done by sending the first email out. Once they open/click emails, the contact is bound to an email address + computer (cookie) and you can see when they return.

Good luck,
Joey

1 Like

Hey @joeyk

Thanks I will try this.

The contacts were imported using the shopify plugin.

I will go ahead and try what you suggested and see how that goes.

Will let you know how it goes.

Thanks

@mikew , I just ran into this myself. Funny to read my answer and getting angry at myself.
In fact, my suggestion doesn’t work.
This is the issue I ran into (running 3.2.1 on this one)

1. User checks shopify page with Mautic tracking

  • tracking works perfectly, anonimous user is created, and tracked properly.

2. User chooses products, goes to the cart

  • tracking still works, contact is seen last in the cart.

3. User pays

  • tracking doesn’t register that, but it’s okay, shopify keeps its system closed.

4. Shopify Plugin submits the email data via API

  • new contact is created with NO tracking history, just an email address. Identified by Shopify Plugin.
    this is still how it’s expected

5. Contact get’s a thank you mail with tracking image and a link

6. User opens email and clicks

  • here is the problem: even by opening on the same browser the Contact Nr. 2. will be continued to be tracked. Our Contact No.1. will be abadoned, and tracking won’t happen anymore, and previous tracking is also not merged together.

So we will have 2 profiles:
Contact No 1.: With pre-purchase info, anonymous
Contact No 2.: With Post-Purchase, identified

And both contacts would have the same Mautic Device Id.

The question is: why are these 2 contacts not merged?
Plz help :slight_smile:

I did reproduce this on multiple occasions.
I would love to know if this is normal behaviour.
The question is: will an anonymous contact merged into a known contact based on an email open?
AND
when does the system merge an unknown contact into a known contact based on mautic device id?

If this is not happening, is that a bug or expected behaviour?

Few thoughts based on my experience:

  • Device fingerprinting iirc doesn’t work as expected.
  • Collapsing a Cookie-based tracking anonymous contact into a known contact can only happen on link click if you append a parameter to your links in the email content that lands people on the site. The Mautic tracking pixel should pick up the HTML encoded email from the URL and automatically merge the activity history of the known contact and the anonymous contact.

I believe the second point of this bullet that you’re missing is to append your links back to the site with something like the following.

?email=jordan%40facetinteractive.com

Hey @jordan_ryan , thank you so much for the answer.
To make sure I understand it right:

  1. Someone visits shopify as an anonymous contact, creating a cookie.
  2. This person purchases something, so I fire the tracking pixel containing the email address on the thank you page
    The contact’s anonymous profile is now extended with the email = converted into a known contact?

Joey

@joeyk - Correct, the records are two-fold in the system until an identification event occurs, and the new anonymous contact gets identified, and they get merged to the identified contact.

I would say the cookie doesnt’ get created, but instead a contact gets created. You can actually see these contacts by going to Contacts and filtering for is:anonymous and you get your list of unidentified users and their behaviors.

Later they’ll get their activities consolidated.

Hey,
I reality it’s not working like this. This is what happens:

  1. Anonym contact visits 10 pages. Mautic leaves the cookie, an anonym contact is created. Lets say ID: 100. The tracking works even if IP is changed, all good.

  2. The person decides to buy a product. He is tracked until the payment page. On the payment page, there is no tracking JS, Shopify doesn’t let us to place it there. So the trail stops at the payment page for ID 100.

  • Payment successful -
  1. An API call is created, where email, name and purchased products are filled out. A new contact is created via API. We call it ID 200. This contact has no cookie placed anywhere, since he was created via server to server communication IN THE BACKGROUND.

  2. Out person now passes the cart page, goes to the confirmation page. There is tracking script again. We can pass the email here to Mautic tracking, since the email is known to us now. So we add the email into the tracking code.

My expectation is, that Mautic realises, that I have ID 100, who’s cookie is on this computer and we are tracking this anonym contact for months, plus I have ID 200, created by API. And it seems, that based on ID 200’s email AND ID 100’s cookie info I shall merge them.

But this doesn’t happen. ID 100 will be ‘abandoned’, and ID 200 will be tracked in the future. So I will only have identified contacts AFTER they purchased something, and their visits from before the purchase will be ‘abandoned’.

@joeyk I got a similar problem some days ago.

Could you please check if your email field is public writable? The thing is that

User opens email and clicks

this point only works if your email field is world writable. Otherwise the lead id information in the link tracking is not used.

(the behaviour is also described in the configuration section for the tracking)

Maybe it solves your problem.

Greetings
Sebastian

Thank you for the idea.
Yes, it is publicly updateable.
I think the problem is, that first I created the contact with API, and just then identified an already existing contact. So Mautic is confused - and doesn’t merge the 2 contacts, but decides to follow only the second one.

I actually have a pretty ugly workaround:
I check who was tracked in with the same IP in the past 10 min, and just merge them in the DB.

Diggin up issues from the past :slight_smile:

I was wondering how a merge could take place.

If I am using the API to pass through an order, I am able to get the IP address in the payload. I can store this is a custom field, my question is "is there a way to merge the anonymous user based on the IP with the new user and his custom field IP ?

I tried hard and failed to get this working.

A work around is to have a hidden mautic form on the page that collects the order, before the data is sent into Mautic via api. The hidden form collects the email address during the order process and drops the cookie on the page.

Then if you match the email address coming in vai the API with the pre existing email addres inserted by the hidden form, the data should merge.