I am using the below code to add a Sitecore contact which works fine in my Standalone environment but is causing issue on CM environment as the contact is coming null.

Tracker.Current.Session.IdentifyAs("known", trackerId.ToString());
var reference = new IdentifiedContactReference("known", trackerId.ToString());
Contact contact = client.Get<Contact>(reference, new ContactExpandOptions() { });

Kindly help.

  • Any errors in the Sitecore or xConnect logs. This code seems fine. – Chris Auer Apr 6 '20 at 16:05
  • No error it is working fine in Standalone but not in CM. @Chris Auer – Gautam Aneja Apr 6 '20 at 18:57
  • Sorry, just remembered that xConnect is not enabled on the CM servers by default. It takes the Content Delivery or Standalone role to make xConnect work. – Chris Auer Apr 7 '20 at 15:01
  • Can you help with this issue? sitecore.stackexchange.com/questions/24825/… – Gautam Aneja Apr 7 '20 at 16:08

It is possible your CM configuration is not configured to detect your site visitors (hence you getting nulls). This makes sense since you don't expect visitors to browse your CM instance.

The Sitecore robot detection component detects robots and unwanted interactions from automated browsers and robots. The component is enabled by default and consists of a pipeline processor, an event handler, a JavaScript file (that detects human behavior), and several robot detection classes.

Please compare your Sitecore.Analytics.Tracking.config in CM environment with that in your Standalone environment for any obvious differences.

This is Sitecore Docs link with more details

  • Thanks for the response. But even in my local system when I also change the role to CM from Standalone the Tracker.Current.Session.IdentifyAs() doesn't work. The problem is as soon I change the role to CM the function stops working. kindly provide a solution @Julius A – Gautam Aneja Apr 6 '20 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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