I have LoginComponent in ReactJs with username and password. How can I store the logged in user details in xDB through ReactJs ?
In case if I am creating an webapi to store the details using Sitecore.Analytics.Tracker.Current.Session.Identify(identifier). Can I still track the user journey further for my personalization thou my components are written in reactjs ?

Any help on this would be really great.

1 Answer 1


The React JavaScript SDK can work with Sitecore tracking and analytics via the Headless Proxy. In "headless mode," all requests are proxied through the node instance, which is also doing server-side rendering of your application. This means that the Sitecore Analytics cookie is associated with the domain of the node server.

Headless Proxy Diagram

If you create a custom endpoint for identifying a user, and proxy it through the Headless Proxy, the analytics cookie will be passed and you can successfully identify the user. The included JSS Tracking API works in the same manner.

Some notes about implementing such an API endpoint:

  • Be sure to use an MVC Controller and not a Web API. Web APIs do not support session, which is required for Sitecore Analytics.
  • Be sure your API path is excluded from rewriting/SSR in your headless proxy configuration.
  • Thank you Nick. Feb 11, 2021 at 13:14
  • np, If it works please mark answer as accepted so others know! Feb 11, 2021 at 13:16
  • Yes sure I will. Feb 11, 2021 at 13:17
  • Hi @nickwesselman Nick I managed to save the user details in the xDB. However the page events and goals is not getting displayed for the saved user. Feb 11, 2021 at 14:05
  • And you've flushed the session / pushed Analytics events? Is robot detection turned off? Feb 11, 2021 at 16:15

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.