I am trying to run some xConnect facet/identification code after a user logs in with Federated Auth. But it seems like all the Owin pipelines have no tracker available. And none of the Sitecore pipelines know you just logged in.

Any pipelines in Sitecore where you know you just logged in with a tracker available.

CreateTracker - user is not logged in yet StartTracker/StartTracking - Tracker is alive, but no way to tell which time is the first page post login. Since StartTracking runs on every page.

2 Answers 2


I created a custom processor in the initializeTracker pipeline


<initializeTracker >
        <processor type="[custom code type]"  patch:after="processor[@type='Sitecore.Analytics.Pipelines.InitializeTracker.CreatePage, Sitecore.Analytics']">

 public class IndentifyContactFromQSToken : InitializeTrackerProcessor
    /// <summary>
    /// Runs the processor.
    /// </summary>
    /// <param name="args">The arguments.</param>
    public override void Process(InitializeTrackerArgs args)
        Assert.ArgumentNotNull(args, "args");
        Assert.IsNotNull(args.Session.CustomData, "args.Session.CustomData");
        //custom code to identify contact if user is authenticated

This is called on each page load so you can identify your user once is logged in. Once contact is identified for current session, you can use a custom flag in session so the custom code is not executed again.

Hope it helps!


I hope someone knows a better way, but I went with this approach:

  1. Create a new pipeline processor on httpRequestProcessed pipeline - I called mine TrackIdentity. Patch it in:

patch:before="processor[@type='Sitecore.Analytics.Pipelines.HttpRequest.EndAnalytics, Sitecore.Analytics']"

  1. Do some null checks to make sure session and tracker is available - it usually should be on the httpRequestProcessed pipeline.
  2. Check if the request is authenticated and the current session is identified, if not then identify the contact and set a session variable to say the session is identified. You could also set/update the contact facets at this point if you wish.
  • I am hearing the same thing from other people. It might be the only way.
    – Chris Auer
    Mar 9, 2021 at 3:05

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.