umami-chrome-extension

Umami Analytics Chrome Extension

A Chrome extension that provides real-time analytics from your self-hosted Umami dashboard directly in your browser. Monitor active users, page views, and visitor statistics without leaving your current tab.

Features

Screenshots

Extension Popup

See the real-time metrics display showing active users, page views, visitors, and visits with trend indicators:

Extension Popup showing real-time analytics

Settings Page

Configure your Umami server credentials and display preferences:

Extension settings page with configuration options

Installation

  1. Visit the Chrome Web Store (Coming soon)
  2. Click β€œAdd to Chrome”
  3. Follow the configuration steps below to set up your credentials

Note: This extension only supports self-hosted Umami servers. It does not support Umami Cloud.

Developer Install

  1. Clone the repository:
git clone https://github.com/0xjessel/umami-chrome-extension.git
cd umami-chrome-extension
  1. Install dependencies:
npm install
  1. Build the extension:
# Build using the optimized build script
./build.sh --clean  # Clean build for development

# For production build with automatic packaging
./build.sh --clean --pack  # Creates a .zip file ready for distribution

# For development with hot reload
npm run dev
  1. Load in Chrome:
    • Open Chrome and go to chrome://extensions/
    • Enable β€œDeveloper mode” (top right)
    • Click β€œLoad unpacked”
    • Select the dist directory
    • The extension icon should appear in your toolbar

Configuration

  1. Click the extension icon and select β€œSettings” or right-click and choose β€œOptions”
  2. Enter your Umami credentials:
    • Enter your self-hosted Umami server URL
    • Enter your username and password
    • Enter your Website ID (found in website settings)
  3. Configure display settings:
    • Choose what metric to show in the extension badge (active users, views, or visitors)
    • Set your preferred update interval
    • Select which metrics to display in the popup

Development

Prerequisites

Setup Development Environment

  1. Install dependencies:
npm install
  1. Start development build with watch mode:
npm run dev
# or
./build.sh --dev
  1. Load unpacked extension from the dist directory

Available Scripts

Build Script Options

The included build.sh script provides several options:

Usage: ./build.sh [options]
Options:
  -h, --help     Display help message
  -d, --dev      Build development version (unminified)
  -c, --clean    Clean build (remove dist directory first)
  -p, --pack     Package extension as zip file after building
  -s, --stats    Display webpack bundle stats analysis

Project Structure

umami-chrome-extension/
β”œβ”€β”€ manifest.json        # Extension manifest
β”œβ”€β”€ background.js       # Service worker for badge updates
β”œβ”€β”€ popup/             # Extension popup UI
β”‚   β”œβ”€β”€ popup.html     # Popup layout and structure
β”‚   β”œβ”€β”€ popup.js      # Real-time metrics display logic
β”‚   └── popup.css     # Popup styling with dark mode
β”œβ”€β”€ options/          # Settings page
β”‚   β”œβ”€β”€ options.html  # Settings form layout
β”‚   β”œβ”€β”€ options.js    # Credentials and display settings
β”‚   └── options.css   # Settings page styling
β”œβ”€β”€ src/             # Shared code
β”‚   β”œβ”€β”€ api.js       # Umami API client for self-hosted servers
β”‚   β”œβ”€β”€ storage.js   # Chrome storage manager for settings
β”‚   └── constants.js # Shared constants and configurations
└── tests/          # Test suite
    └── api.test.js  # API client tests

Security

Privacy

This extension is designed with privacy in mind:

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This extension is not officially affiliated with Umami but was built with appreciation for their open-source analytics solution.

Troubleshooting

Common Issues

  1. Failed to initialize API

    • Verify your server URL is correct and includes the protocol (http:// or https://)
    • Check your username and password
    • Ensure your Website ID is correct
  2. Badge not updating

    • Check if your credentials are still valid
    • Try clicking the refresh button in the popup
    • Verify your polling interval settings
  3. Extension showing no data

    • Confirm you have active traffic on your website
    • Check if your Umami server is collecting data properly
    • Try reopening the popup
  4. Extension size is large when loading unpacked

    • Make sure to load ONLY the dist directory when using β€œLoad unpacked”
    • The full project directory includes development dependencies that are not needed for the extension
    • Use ./build.sh --clean before loading the extension
  5. Console errors about null elements

    • This extension properly handles DOM loading timing to prevent errors
    • All element access is deferred until after DOMContentLoaded event
    • Null checks are implemented throughout the codebase to prevent errors
    • If you experience any DOM-related errors, please report them as issues