3

Sitecore's documentation always talks about how the same person comes back to the site and is identified. How are multiple persons handled?

Say that a person first enters the site (anonymous tracking), he logs in, and the tracking becomes an identified contact. The person logs out, but then his wife logs in, in the same browser, without closing anything. What happens in this scenario?

The SC_ANALYTICS_GLOBAL_COOKIE will at that moment still point to the first person, and when identifying the second person, contact data will be merged.

This instinctively seems like a bad idea, and seems like it will copy data from the first contact to the second contact. Can Tracker.Current.Contact be fully trusted in such scenarios (when logged in or not)?

So what is really happening when you have two people using the same computer/browser, which dangers does it pose, and how can you resolve any potential conflicts arising from such usage?

Sitecore 9.1

2 Answers 2

2

No matter what, if you identify the user each time they log in, you will be fine.

Tracker.Current.Session.IdentifyAs(source, identifier);

If the husband is logged in, you will notice the Tracker.Current.Session.Contact.ContactId will be one ID. And when you IdentifyAs() the wife, the ID will change to her contact ID. The husbands session will time out and be written to xDB. But the wife's session will continue on a new. You will also notice the page history and all will be new for the wife and include none of the husbands history.

0

Pete Navarra wrote a blog post touching this subject (See the last part "Why is managing the contact cookie important").

Basically he describes to end the visit and invalidate the cookie by using 2 lines of code:

Tracker.Current.EndVisit(true);
HttpContext.Current.Session.Abandon();

In case visitors do not end their session by logging out I don't think there's any way to prevent a mixup of interactions.

1
  • Worth noting, that these lines of code would be done on the Log Out method, when the first spouse logs out, in the example on the question. Also, glad to know that blog was helpful!
    – Pete Navarra
    Mar 19, 2019 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.