After enabling the Sitecore 9 analytics, when I open the Experience Profile, I see all the WebApi ajax calling as page view events or page events in the Experience Profile.

Why this is happening?

Is there any way to prevent that?

BTW, in our system, session is enabled for WebApi calls.

3 Answers 3


The best way to tackle this is to add an Action Filter on your Controller actions to prevent the events from showing up in your Analytics Reports.

Filter code:

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class DisableTrackingAttribute : ActionFilterAttribute
    public override void OnActionExecuting(ActionExecutingContext filterContext)
        if (!Tracker.IsActive || Tracker.Current == null)

        if (Tracker.Current != null && Tracker.Current.CurrentPage != null)


Example Controller code:

public class AnalyticsController : ServicesApiController
    public dynamic TriggerPageEvent(string eventId, string setUrl = null)
        Some logic
  • Hi, thanks for you reply. I found my solution through your answer. Although I implemented it using pipeline.
    – Foysal
    Jun 4, 2018 at 9:07

Take a look on page event settings for "Page Visit":


I think that if you modify "Rules" field you can filter out traffic to web api.


This is how I have always done it:

            <!-- Page paths must begin with "/" -->
            <add path="/api/xxxxxx"/>
            <add path="/api/xxxxxx1"/>

If you want support for wildcard exclusions, there is a module that you can reference.

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.