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.

up vote 5 down vote accepted

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" ||
                                        "SC_ANALYTICS_SESSION_COOKIE")
                                {
                                        response.Cookies.Remove(cookie);
                                }
                        }
                }
        }
}

you have to create your own httpModule:

    <configuration>
  <system.webServer>
    <modules>
      <add type="ClearCookieHttpModule, AssemblyName" name="ClearCookieHttpModule"/>
    </modules>
  </system.webServer>
</configuration>

http://derekdysart.com/disabling-the-sitecore-analytics-cookie/

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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