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.
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:
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