SaaS CMS has officially launched! Learn more now.

EPiServer Find statistics DNT on track() and ajax controller



We have article page where we are using EPiServer Find track() method to track the statistic detail for search phrase and we are using Ajax call in controller to pass search term and call EPiServer Find search functionality to fetch the results. When we change the browser setting to Do not track without adding the below code not to track either in main action method or ajax json method, it doesn't record that particular search phrase in statistics details and obeys DNT. 

string doNotTrackHeader = this.Request.Headers.Get("DNT");

if (doNotTrackHeader == null || doNotTrackHeader.Equals("0"))


 var search = search.track();


Please help us understand why is it respecting DNT without adding this code when it is ajax and required this code when it passes through main action method within MVC controller.

May 14, 2020 8:54


Before recording search stats, Episerver Search and Navigation (Find) checks the DNT header and will obey what's set without you needing to specifically implement anything to handle it:

May 15, 2020 8:09

Hi Paul,

If we are doing it via controller action it needs the code mentioned above to obey DNT from browser setting. Fot Ajax controlled action method it doesn't require any code to obey browser DNT setting.

We are not able to understand why is it behaving different for ajax jsonresult method and controller main action method within same page controller

May 18, 2020 5:09
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.