Skip to Content
Advanced TrackingExcluding specific events from auto-capture

How to exclude some or all auto-captured events

While Usermaven’s auto-capture feature is powerful for collecting a baseline of user interactions, you may want to exclude certain events to reduce data noise, lower costs, or protect user privacy. This guide details three methods for controlling your event tracking, from excluding individual elements to disabling auto-capture entirely.

Choosing the right method

Use this table to quickly decide which method is best for your needs. It’s always recommended to start with the most specific method possible (Method 1) before moving to broader exclusions.

MethodGranularityBest For
1. Exclude elementsHigh (Specific sections)Ignoring noisy components like navbars or cookie banners without affecting the rest of the page.
2. Exclude pagesMedium (Entire pages)Disabling all auto-capture on pages like admin dashboards or settings panels that have many irrelevant interactions.
3. Disable completelyLow (Entire website)Switching to a fully manual tracking plan where you only use Pinned Events or send Custom Events.

Method 1: Excluding specific elements or sections

This is the most precise method to optimize your data collection, allowing you to prevent tracking on specific parts of a page like a navigation bar, a cookie consent banner, or a container with many interactive elements.

To achieve this, you can add the um-no-capture class to any HTML element. Usermaven will ignore all auto-captured events that occur within that element and any of its children.

How to use the “um-no-capture” class

  1. Begin by identifying the section or container from which you wish to exclude auto-captured events within your website’s source code.
  2. Once identified, apply the um-no-capture class to the desired element. This is done by adding it to the class attribute of the corresponding HTML element.

Code:

<div class="your-existing-class um-no-capture"> <!-- Your existing code --> </div>

Example use case:

Suppose you have a complex web application with a “main design editor” section. This area might have hundreds of clickable elements that are not relevant to your core user journey analysis.

To prevent Usermaven from tracking these events, you would simply apply the um-no-capture class to the main container of the editor. This ensures that only events outside of this specific container are tracked.

Note: After implementing the um-no-capture class, all events originating from within that section or container will be automatically exempted from being tracked by auto-capture.


Method 2: Disabling auto-capture on specific pages

For pages with many interactions where most events are not valuable (e.g., admin dashboards), you can disable auto-capture on a per-page basis by modifying the tracking script. This requires a developer to add conditional logic that sets the data-autocapture attribute to false on specific pages.

Here is an example script modified to disable auto-capture on multiple pages:

// - The rest of the script remains the same - // Define pages where auto-capture should be disabled const excludedPaths = ['/settings', '/admin', '/billing']; const isAutoCaptureDisabled = excludedPaths.some(path => window.location.pathname.startsWith(path)); // Dynamically set data-autocapture based on current page t.setAttribute('data-autocapture', isAutoCaptureDisabled ? 'false' : 'true'); // — The rest of the script remains the same —

Method 3: Disabling auto-capture completely

If you decide you only want to track events using manual methods like Pinned Events and Custom Events, you can disable auto-capture entirely across your whole site.

Option 1: Use the settings in your Usermaven workspace (Recommended)

  1. Navigate to Workspace settingsSetup in your Usermaven dashboard.
  2. Toggle off the “Automatically capture frontend events” option.
  3. Copy the updated tracking script and use it to replace the old one on your website.

Option 2: Manually edit your tracking script

If you are comfortable editing code, find and completely remove the following line from the Usermaven tracking script on your website:

// - Remove this line from the script - t.setAttribute('data-autocapture', 'true');

If this attribute is not present in the script, auto-capture will be disabled by default.


Important considerations

Impact on pinned events

Pinned events rely on auto-captured data. If you exclude an element or an entire page using one of these methods, you will not be able to create a Pinned Event for any user interactions in that area. The underlying data simply won’t exist.

Interaction with custom events

These exclusion methods only apply to auto-captured events. Any custom events you send manually using usermaven("track") will still be captured, even if they are triggered from within a um-no-capture container or on a page where auto-capture is disabled.

How to verify your changes

After making changes, you can confirm they are working correctly:

  • For Method 1: Use your browser’s “Inspect Element” tool to verify that the um-no-capture class is present on the correct HTML elements.
  • For all methods: Visit the page in question and check the “Live” view or “Events Activity” page in your Usermaven dashboard to ensure that clicks and other interactions from the excluded areas no longer appear in the event feed.
Last updated on