I want to implement the tracking for anonymous contacts and known contacts to my site.

How can I Implement ? Is Sitecore 9.1 tracks the known contacts also by default?

Or I need to track via code ? If yes using code, Please provide some idea about implementation..

Thanks in advance.


1 Answer 1


In a nutshell, you must make sure that Xdb.Tracking.Enabled setting is set to true and that you have VisitorIdentification in your layout.

More details from Sitecore documentation site ( https://doc.sitecore.com/developers/91/sitecore-experience-platform/en/enabling-tracking.html )

To enable tracking:

  • Ensure that Xdb.Tracking.Enabled is set to true - see the Experience Manager documentation for more information.

  • Ensure that layouts contain the VisitorIdentification tag or MVC helper.

  • If you are using ASP.NET MVC, use the MVC helper:

@using Sitecore.Mvc.Analytics.Extensions


  • If you are using ASP.NET Web Forms use the following tag:

<!-- ASP.net>

<sc:VisitorIdentification runat='server'/>

As @Trayek mentioned in his comment, Sitecore by default doesn't index anonymous contacts. It means that anonymous contacts data is stored but it's not displayed e.g. in Experience Profile application.

In Sitecore 8.2 you can use the setting:

<setting name="ContentSearch.Analytics.IndexAnonymousContacts" value="true"/>

If you use Sitecore 9 you should look at this article as well https://doc.sitecore.com/developers/91/sitecore-experience-platform/en/enable-indexing-of-anonymous-contacts.html

If you want to identify a contact, use

Sitecore.Analytics.Tracker.Current.Session.IdentifyAs("sitecoreextranet", "myrtlesitecore");

More about contact identification in Sitecore docs: https://doc.sitecore.com/developers/91/sitecore-experience-platform/en/identifying-contacts.html

  • It's worth adding that out of the box Sitecore will not index the anonymous contacts so changes are required to show those in xFile.
    – Trayek
    Commented May 22, 2019 at 9:45
  • 1
    It will track only anonymous contacts.I want to track known contacts also, kindly advise on this
    – Indhumathi
    Commented May 22, 2019 at 9:49
  • 1
    @Trayek thanks, I edited the answer. Inhumanthi it will track both anonymous and known contacts.
    – Marek Musielak
    Commented May 22, 2019 at 9:52
  • thanks,how the known contacts are identified during his visit?
    – Indhumathi
    Commented May 22, 2019 at 10:02
  • There is a big difference between tracking contacts and identification of a contact. You haven't asked that one in the original question. I added extra information about contact identification in my answer. Usually you pass user email address or some known id from another system as contact identifier.
    – Marek Musielak
    Commented May 22, 2019 at 10:06

Your Answer

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

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