# Location is not set to contact

**URL:** <https://forum.mautic.org/t/location-is-not-set-to-contact/35502>\
**Category:** Mautic 5 Install/Upgrade Support\
**Created:** [April 11, 2025, 3:57pm UTC](https://forum.mautic.org/t/location-is-not-set-to-contact/35502 "2025-04-11T15:57:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![n.louahedj](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/n.louahedj/32/13901_2.png) [@n.louahedj](https://forum.mautic.org/u/n.louahedj)\
**Post date:** [April 11, 2025, 3:57pm UTC](https://forum.mautic.org/t/location-is-not-set-to-contact/35502/1 "2025-04-11T15:57:20Z")

</div>

**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.

---

<div class="post-metadata">

**Author:** ![sbolinches](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/sbolinches/32/9092_2.png) [@sbolinches](https://forum.mautic.org/u/sbolinches)\
**Post date:** [September 8, 2025, 11:17am UTC](https://forum.mautic.org/t/location-is-not-set-to-contact/35502/2 "2025-09-08T11:17:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![green3rd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/green3rd/32/14499_2.png) [@green3rd](https://forum.mautic.org/u/green3rd)\
**Post date:** [October 8, 2025, 5:39am UTC](https://forum.mautic.org/t/location-is-not-set-to-contact/35502/3 "2025-10-08T05:39:13Z")

</div>

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](https://github.com/mautic/mautic/blob/ffee622c4d5057d99b4e1a2fac0e7d01a6531675/app/bundles/LeadBundle/Helper/ContactRequestHelper.php#L92), 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.

---

<div class="post-metadata">

**Author:** ![green3rd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/green3rd/32/14499_2.png) [@green3rd](https://forum.mautic.org/u/green3rd)\
**Post date:** [October 8, 2025, 2:52pm UTC](https://forum.mautic.org/t/location-is-not-set-to-contact/35502/4 "2025-10-08T14:52:26Z")

</div>

After looking into the code. I think a better place to add those line should be after this [try-catch block](https://github.com/mautic/mautic/blob/72d2ea91f6c648decbd102c262e741f86a82043e/app/bundles/PageBundle/Controller/PublicController.php#L510).

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

Note that `$pageModel->hitPage` can call [leadModel-\>saveEntity](https://github.com/mautic/mautic/blob/72d2ea91f6c648decbd102c262e741f86a82043e/app/bundles/PageBundle/Model/PageModel.php#L1110) as well. but when I tested it, it [exited the function](https://github.com/mautic/mautic/blob/72d2ea91f6c648decbd102c262e741f86a82043e/app/bundles/PageBundle/Model/PageModel.php#L378) from the start.
