Mautic Community Forums

Tracking site which one can log out from

Hello! Thank you for maintaining Mautic!



We have application where users can log in and out. Mautic tracking works this way:

  • User hits the page - tracking code is loaded and we provide user ID 1 (which is marked as unique)
  • Mautic creates anonymous lead and assignes ID:1 and find that ID 1 is already present and merges these two leads together

    (everything is great till now!)
  • user logs out
  • logs as another user (without closing browser; mautic cookies were not flushed; Mautic sees this as one session)
  • we send ID:2 into Mautic tracking code
  • mautic finds that it knows this contact with ID:2 and merges lead ID:2 with lead ID:1 - Whops! We have lost one contact.



    Is this bug? Or are we using tracking code in wrong way?
Code:

Problem is that Mautic tracks user by cookie/session. When it does not know which lead is it - it creates new lead. But there is no way to say in tracking code:
Quote:
Hey Mautic, from now cookie:abcd is lead with ID:1.

Is there any what how to do this?

Hello! Thank you for maintaining Mautic!

We have application where users can log in and out. Mautic tracking works this way:

  • User hits the page - tracking code is loaded and we provide user ID 1 (which is marked as unique)
  • Mautic creates anonymous lead and assignes ID:1 and find that ID 1 is already present and merges these two leads together
    (everything is great till now!)
  • user logs out
  • logs as another user (without closing browser; mautic cookies were not flushed; Mautic sees this as one session)
  • we send ID:2 into Mautic tracking code
  • mautic finds that it knows this contact with ID:2 and merges lead ID:2 with lead ID:1 - Whops! We have lost one contact.

Is this bug? Or are we using tracking code in wrong way?

<script n:if="$user->loggedIn">
	(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','http://localhost:8000/mtc.js','mt');

	mt('send', 'pageview', { uuid: {$user->identity->getId()->toString()}});

</script>

Problem is that Mautic tracks user by cookie/session. When it does not know which lead is it - it creates new lead. But there is no way to say in tracking code:

Is there any what how to do this?