Files
MyClub/DOCS/ANALYTICS_GRAPH_FIX.md
Tomáš Dvořák 12cba639b9 upload
2025-10-16 13:32:05 +02:00

3.7 KiB

Analytics Graph Fix - No Data Displayed

Problem

The analytics graph in the admin panel shows no data or is completely empty.

Root Cause

The UMAMI_WEBSITE_ID environment variable is empty in your .env file. Without a valid website ID, the backend cannot fetch analytics data from Umami.

Solution

The system will automatically detect the first available website from your Umami instance:

  1. Ensure Umami is running and accessible at the URL specified in UMAMI_URL
  2. Restart your backend server (the system will auto-detect on the first analytics request)
  3. Check the logs for messages like:
    [INFO] Attempting to get default Umami website ID from https://umami.tdvorak.dev
    [INFO] Found default Umami website: ID=xxxxx, Name=MyWebsite, Domain=example.com
    [INFO] Using Umami website ID: xxxxx
    

Option 2: Manually Set Website ID

If you know your Umami website ID:

  1. Log in to your Umami dashboard at https://umami.tdvorak.dev
  2. Navigate to Settings > Websites
  3. Copy the Website ID (usually a UUID like 12345678-1234-1234-1234-123456789abc)
  4. Update your .env file:
    UMAMI_WEBSITE_ID=12345678-1234-1234-1234-123456789abc
    
  5. Restart your backend server

Option 3: Create a New Website in Umami

If no websites exist in your Umami instance:

  1. Log in to Umami at https://umami.tdvorak.dev
  2. Create a new website with:
    • Name: Your club name (e.g., "Fotbal Club")
    • Domain: Your website domain (e.g., "example.com")
  3. Follow Option 1 or Option 2 above

Verification

After applying the fix:

  1. Check Backend Logs for successful connection messages:

    [INFO] Successfully authenticated with Umami at https://umami.tdvorak.dev
    [INFO] Successfully fetched Umami stats for websiteID=xxxxx (days=7)
    [INFO] Successfully fetched 10 Umami metrics (websiteID=xxxxx, type=url, days=7)
    
  2. Refresh the Analytics Page in the admin panel (/admin/analytika)

  3. You should see:

    • Statistics cards with visitor counts
    • A graph showing page views over time
    • Country flags showing visitor locations
    • Tables with top pages, browsers, etc.

Troubleshooting

Issue: "No websites found in Umami instance"

Solution: Create a website in your Umami dashboard first

Issue: "Authentication failed"

Solution: Check UMAMI_USERNAME and UMAMI_PASSWORD in .env

Issue: "Failed to send list websites request"

Solution: Ensure UMAMI_URL is correct and Umami is accessible

Issue: Graph shows but with "Žádná data pro zobrazení"

Cause: No traffic has been recorded yet Solution:

  • Visit your website to generate some traffic
  • Check that the Umami tracking script is loaded on your frontend
  • Wait a few minutes for data to appear

Enhanced Error Display

The analytics page now shows:

  • Orange warning banner when Umami is not configured or has no data
  • Empty state message in the graph when no pageviews are recorded
  • Detailed error messages explaining the issue
  • Console logging for debugging (check browser dev tools)

Configuration Summary

Required .env variables:

UMAMI_URL=https://umami.tdvorak.dev          # ✓ Configured
UMAMI_USERNAME=admin                          # ✓ Configured  
UMAMI_PASSWORD=eevRQ6h3G@!c#y4A1T            # ✓ Configured
UMAMI_WEBSITE_ID=                             # ✗ Empty (will auto-detect)

Next Steps

  1. Restart your backend: docker-compose restart backend or make run
  2. Open admin panel: http://localhost:3000/admin/analytika
  3. Check if data appears
  4. If not, check backend logs for error messages
  5. Verify Umami is accessible at https://umami.tdvorak.dev