5

In our site we have some Ajax calls for performance measurements and cookie management. These calls show up in the path analyzer and distort the statistics. They are reported as most visited and most efficient category which is, of course, not wat we want to see.

In the marketing Control Panel you can add filtering rules for each Map, but I'm not sure if that would even work (I could test this of course), but would really like to add some paths to a config file and filter them globally. Is there a way to configure this?

0

3 Answers 3

6

Making the assumption that your ajax calls go to some code of your own, you could add Tracker.Current.CurrentPage.Cancel(); to that code to tell Sitecore not to add a record for this interaction. This way your ajax calls will no longer be in the analytics.

This is a solution for future requests - it does not remove the data that is already in your analytics though.

1
  • 1
    Thank you, I was searching in completely the wrong direction :) This also makes much more sense as it is the developers responsibility Commented Oct 26, 2016 at 10:01
2

Alternative solution is to create custom Map Type. In the custom map type you can implement filter for map tree builder. This way you dont have to disable tracker and loose valuable information, and you dont have to delete historical data.

Full description and code is available in the following post: http://brimit.com/blog/path-analyzer-custom-map-type-ajax-calls-fil‌​ter

Posting again, since its not a comment at all. Its an answer to the initial question.

1

I dont see it in your code, but I imagine you are using MVC controllers for your API calls. Use this controller attribute on your APIs to make Sitecore ignore them.

public class SkipAnalyticsTrackingApiAttribute : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        Tracker.Current?.CurrentPage?.Cancel();
    }
}

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.