Because of EU legislation, sometimes you have to block tracking cookies from being deployed. In Sitecore's case this would mean the SC_ANALYTICS_GLOBAL_COOKIE, since it's not absolutely necessary for the functioning of the site (it's necessary for analytics/personlization).

Looking through Sitecore, this cookie is deployed by the Sitecore.Analytics.Pipelines.EnsureSessionContext.EnsureDevice pipeline. But I always dislike overriding Sitecore pipeline if I can avoid it (rather add pipepeline components if necessary).

So, have you found other/better ways to to block the SC_ANALYTICS_GLOBAL_COOKIE from being deployed?

Secondary Answer (Edit): The link provided by sestocker in the comment has excellent options, such as settig Tracker.Enable to false in the pre-initialization stage of your page, etc. Those work really well for disabling the SC_ANALYTICS_GLOBAL_COOKIE, but Sitecore Climbers answer also works, and will help with for example the #lang cookie, since there's no switch to turn that one off.

  • 3
    Check out this thread: sitecore.stackexchange.com/questions/1454/…. I think the best approach would be a pipeline where you set Tracker.Enabled to false.
    – sestocker
    Commented May 11, 2017 at 1:49
  • @sestocker thanks! I don't know how I didn't find that post earlier. I'll try those out. Commented May 11, 2017 at 14:16

2 Answers 2


You can create your own class:

public class ClearCookieHttpModule : IHttpModule
        public void Dispose() { }

        public void Init(HttpApplication context)
                //hook end request
                context.EndRequest += new EventHandler(OnEndRequest);

        void OnEndRequest(object sender, EventArgs e)
                if (clearCookies)
                        HttpApplication app = (HttpApplication)sender;
                        var request = app.Request;

                        foreach (var cookieName in response.Cookies.AllKeys)
                                if (cookieName == "SC_ANALYTICS_GLOBAL_COOKIE" ||

you have to create your own httpModule:

      <add type="ClearCookieHttpModule, AssemblyName" name="ClearCookieHttpModule"/>



This will still track the visit

I used a pipeline to patch the startAnalytics pipeline and stopped the visit before it even started with args.abortPipeline()

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.