I would probably try to add new module to web.config to remove
SC_ANALYTICS_GLOBAL_COOKIE if the IP address is located in certain countries. You could you services like https://www.iplocation.net/ and its API to ask which country this IP address is located. Then you compare that country name from Sitecore or file that contains
GDPR country list.
In order to handle this scenario this way is to create a new
IHttpModule like this:
public class CheckCountryHttpModule : IHttpModule
public void Init(HttpApplication context)
context.PreSendRequestHeaders += PreSendRequestHeaders;
private void PreSendRequestHeaders(object sender, EventArgs e)
HttpApplication app = sender as HttpApplication;
if(Sitecore.Context.Database == null || Sitecore.Context.Database.Name == "core" || app.Context.Request.RawUrl.StartsWith("/sitecore")
// Check location based on ip address
// Remove Sitecore AnalyticsCookie from response
Lastly, you need to add this to
<add type="namespace.CheckCountryHttpModule, AssemblyFile" name"CheckCountryHttpModule" />
Although you have to know that if user is behind a VPN, the country can be different than where the real user is.