Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

hilja
Copy link

@hilja hilja commented Oct 4, 2025

Analytic is important activity but not as important as main business logic. Setting low priority doesn't mean the fetch call will be more likely to be discarded etc. it's just a hint to the browser.

Analytic is important activity but not as important as main business
logic. Setting low priority doesn't mean the fetch call will be more
likely to be discarded etc. it's just a hint to the browser.
Copy link

vercel bot commented Oct 4, 2025

@hilja is attempting to deploy a commit to the umami-software Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This PR adds a single line to the Umami analytics tracker that sets the fetch priority to 'low' for all analytics requests. The change is made in the `send` function within `src/tracker/index.js`, specifically adding `priority: 'low'` to the fetch options object that handles sending tracking data to the analytics endpoint.

The modification leverages the Fetch Priority API, which allows developers to provide hints to the browser's resource scheduler about the relative importance of different network requests. By setting analytics requests to low priority, the tracker ensures that critical application resources (HTML, CSS, JavaScript, images) are prioritized over analytics data collection.

This change integrates seamlessly with the existing codebase architecture. The tracker's send function is the central point where all analytics data (page views, events, user identification) is transmitted to the backend. The fetch options object already includes configurations for method, headers, and body - this PR simply adds the priority hint to that existing structure. The change maintains backward compatibility since browsers that don't support the Fetch Priority API will simply ignore the unknown option.

Important Files Changed

Changed Files
Filename Score Overview
src/tracker/index.js 5/5 Added fetch priority hint to set analytics requests to low priority

Confidence score: 5/5

  • This PR is safe to merge with minimal risk as it only adds a performance optimization hint
  • Score reflects the simple, non-breaking nature of adding a browser hint that improves resource prioritization
  • No files require special attention as this is a single-line addition with well-established browser support

Sequence Diagram

sequenceDiagram
    participant User
    participant Browser
    participant Tracker
    participant Server

    User->>Browser: "Loads page with tracker script"
    Browser->>Tracker: "Executes tracker initialization"
    Tracker->>Tracker: "Check if tracking disabled"
    alt Auto-track enabled and not disabled
        Tracker->>Tracker: "Initialize tracking"
        Tracker->>Browser: "Set up event listeners"
        Tracker->>Server: "Send initial pageview (priority: low)"
        Server-->>Tracker: "Response with cache/disabled status"
    end
    
    User->>Browser: "Clicks tracked element"
    Browser->>Tracker: "Click event triggered"
    Tracker->>Tracker: "Extract event data from attributes"
    Tracker->>Server: "Send event data (priority: low)"
    Server-->>Tracker: "Response with cache/disabled status"
    
    User->>Browser: "Navigates to new page (SPA)"
    Browser->>Tracker: "History state change detected"
    Tracker->>Tracker: "Update current URL"
    Tracker->>Server: "Send pageview after delay (priority: low)"
    Server-->>Tracker: "Response with cache/disabled status"
    
    User->>Tracker: "Calls umami.track() manually"
    Tracker->>Server: "Send custom event (priority: low)"
    Server-->>Tracker: "Response with cache/disabled status"
    
    User->>Tracker: "Calls umami.identify() with user data"
    Tracker->>Server: "Send identify event (priority: low)"
    Server-->>Tracker: "Response with cache/disabled status"
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.