Location is not set to contact

Your software
My Mautic version is: 5.2.3
My PHP version is: 8.3.19

Your problem
My problem is: I am using GeoLite2 City, the database is being downloaded normally (via cron job everyday), but contacts (identified and anonymos) have no location information

These errors are showing in the log: no infomration related to location.

1 Like

Hi! Did you manage to resolve this issue? Contact locations aren’t being recorded in my app. I verified that the cron job runs correctly and downloads the GeoLite2 ciy database. But… I don’t see the location in contacts.
Thanks

I have the same issue.

I dig to the code and find out that the ip and locations from Maxmind were saved to table ip_addresses correctly. The problem is the mapping between contact and ip wasn’t saved in the table lead_ip_xref.

I found that the only time that it will update the table `lead_ip_xref` is when the function leadModel->saveEntity has been called.

So if you call $this->leadModel->saveEntity($this->trackedContact); after this line, the contact will be updated with locations from Maxmind after a user clicked any link on your email.

I’m not sure is this the right solution. I will dig into the code more to find a better place to put that code.

After looking into the code. I think a better place to add those line should be after this try-catch block.

Since getContactFromQuery is used by many places and not all of those required this code.

Note that $pageModel->hitPage can call leadModel->saveEntity as well. but when I tested it, it exited the function from the start.