Your software
My Mautic version is: 4.0.0-features
My PHP version is: 7.4
My Database type and version is: tidb
I don’t believe this is working as intended, but want to ask to make sure.
I am using mtc.js tracking. I find i end up with a lot of duplicates.
First, I end up with duplicate IP addresses:
m> select * from ip_addresses where id in ('159','204','30183','60190','60191');
+-------+---------------+----------------+
| id | ip_address | ip_details |
+-------+---------------+----------------+
| 159 | XX9.205.64.16 | a:10:{s:4:...} |
| 204 | XX9.205.64.16 | a:10:{s:4:...} |
| 30183 | XX9.205.64.16 | a:10:{s:4:...} |
| 60190 | XX9.205.64.16 | a:10:{s:4:...} |
| 60191 | XX9.205.64.16 | a:10:{s:4:...} |
+-------+---------------+----------------+
Then I find that the same lead is attached over and over to these:
> select * from lead_ips_xref where lead_id = 60316;
+---------+-------+
| lead_id | ip_id |
+---------+-------+
| 60316 | 159 |
| 60316 | 204 |
| 60316 | 30183 |
| 60316 | 60190 |
| 60316 | 60191 |
+---------+-------+
And, i find that the Lead has been created multiple times:
> select email,firstname from leads where id in (633, 60316);
+---------------------------+-----------+
| email | firstname |
+---------------------------+-----------+
| NULL | NULL |
| USER@Domain | Name |
+---------------------------+-----------+
I was of the understanding that Identify visitors by IP
(which I have enabled) would cause these to be merged together instead of created separate.
I seems Fix #7559: Merge lead devices when merging leads (3.x rebase of #7561) by pjeby · Pull Request #8836 · mautic/ma was created to solve this, but does not for mtc.js.
Am I understanding this correctly? I think the intent is:
- user interacts w/ mtc.js, contact id created
- user interacts w/ some form etc, gives email, contact id is updated
- user opens new device, interacts w/ mtc.js, contact id is updated
Instead i see a new contact id for each of the 3 above.
It seems, in ContactTracker.php, that we must have both ‘track_contact_by_ip’ and ‘anonymize_ip’, is that correct?
if ($this->coreParametersHelper->get('track_contact_by_ip') && $this->coreParametersHelper->get('anonymize_ip')) {
/** @var Lead[] $leads */
$leads = $this->leadRepository->getLeadsByIp($ip->getIpAddress());
if (count($leads)) {
$lead = $leads[0];
$this->logger->addDebug("CONTACT: Existing lead found with ID# {$lead->getId()}.");
return $lead;
}
}
Comments?
I created PR
to solve this (I think)