Skip to content

Custom Events and Outbound Links aren't being tracked (Self-hosted, Manual Docker, Nginx) #617

@timothyoesch

Description

@timothyoesch

Let me start off by saying: Fabulous app, finally some full featured FOSS analytics with a gorgeous UI.

My issue

Whatever method of rybbit integration I use (I have tried directly in the head, through the wordpress plugin, in nuxt), most functionality works (pageviews and even session replays for sure, I haven't tried error tracking but that's just cause my sites don't create any errors 😏) but custom events and outbound links aren't being tracked.

My investigation

Outbound link tracking is turned on in the site settings and the track event is being sent properly from the client side.

// POST payload to ANALYTICSDOMAIN/api/track
{
   "site_id":"3593434cf857",                // Site id is correct
   "hostname":"***************",
   "pathname":"/",
   "querystring":"",
   "screenWidth":1728,
   "screenHeight":1117,
   "language":"en-CH",
   "page_title":"Hello World :-)",
   "referrer":"",
   "type":"custom_event",                   // "outbound" for Outbound links
   "event_name":"Signup Button Clicked",    // Whatever event name doesn't work
   "properties":"{}"                        // Contains URL, text and target properties for outbound links
}

// With 200 Response
{
   "success":true                            // Somehow I don't believe you.
}

And yet: No custom events nor outbound link clicks are shown in the panel.

My setup

  • Docker Docker Engine Version: 28.3.3
  • Docker Compose Version 2.39.1
  • Docker compose file:
services:
  ## Caddy Service completely removed cause I am using my own NGINX

  clickhouse:
    container_name: clickhouse
    image: clickhouse/clickhouse-server:25.4.2
    volumes:
      - clickhouse-data:/var/lib/clickhouse
    configs:
      - source: clickhouse_network
        target: /etc/clickhouse-server/config.d/network.xml
      - source: clickhouse_json
        target: /etc/clickhouse-server/config.d/enable_json.xml
      - source: clickhouse_logging
        target: /etc/clickhouse-server/config.d/logging_rules.xml
      - source: clickhouse_user_logging
        target: /etc/clickhouse-server/config.d/user_logging.xml
    environment:
      - CLICKHOUSE_DB=${CLICKHOUSE_DB:-analytics}
      - CLICKHOUSE_USER=${CLICKHOUSE_USER:-default}
      - CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-frog}
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8123/ping"]
      interval: 3s
      timeout: 5s
      retries: 5
      start_period: 10s
    restart: unless-stopped

  postgres:
    image: postgres:17.4
    container_name: rb-postgres  ## Specificity, because another service is using postgres as well, might this be causing issues? 
    environment:
      - POSTGRES_USER=${POSTGRES_USER:-frog}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-frog}
      - POSTGRES_DB=${POSTGRES_DB:-analytics}
    volumes:
      - postgres-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 3s
      timeout: 5s
      retries: 5
      start_period: 10s
    restart: unless-stopped

  backend:
    image: ghcr.io/rybbit-io/rybbit-backend:${IMAGE_TAG:-latest}
    container_name: backend
    build:
      context: .
      dockerfile: server/Dockerfile
    ports:
      - "${HOST_BACKEND_PORT:-127.0.0.1:3001:3001}"
    environment:
      - NODE_ENV=production
      - CLICKHOUSE_HOST=http://clickhouse:8123
      - CLICKHOUSE_DB=${CLICKHOUSE_DB:-analytics}
      - CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-frog}
      - POSTGRES_HOST=rb-postgres     ## See above
      - POSTGRES_PORT=5432
      - POSTGRES_DB=${POSTGRES_DB:-analytics}
      - POSTGRES_USER=${POSTGRES_USER:-frog}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-frog}
      - BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
      - BASE_URL=${BASE_URL}
      - DISABLE_SIGNUP=${DISABLE_SIGNUP}
      - DISABLE_TELEMETRY=${DISABLE_TELEMETRY}
    depends_on:
      clickhouse:
        condition: service_healthy
      postgres:
        condition: service_started
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3001/api/health"]
      interval: 3s
      timeout: 5s
      retries: 5
      start_period: 10s
    restart: unless-stopped

  client:
    image: ghcr.io/rybbit-io/rybbit-client:${IMAGE_TAG:-latest}
    container_name: client
    build:
      context: .
      dockerfile: client/Dockerfile
      args:
        NEXT_PUBLIC_BACKEND_URL: ${BASE_URL}
        NEXT_PUBLIC_DISABLE_SIGNUP: ${DISABLE_SIGNUP}
    ports:
      - "${HOST_CLIENT_PORT:-127.0.0.1:3002:3002}"
    environment:
      - NODE_ENV=production
      - NEXT_PUBLIC_BACKEND_URL=${BASE_URL}
      - NEXT_PUBLIC_DISABLE_SIGNUP=${DISABLE_SIGNUP}
    depends_on:
      - backend
    restart: unless-stopped

volumes:
  clickhouse-data:
  postgres-data:
  redis-data:

configs:
  clickhouse_network:
    content: |
      <clickhouse>
          <listen_host>0.0.0.0</listen_host>
      </clickhouse>

  clickhouse_json:
    content: |
      <clickhouse>
          <settings>
              <enable_json_type>1</enable_json_type>
          </settings>
      </clickhouse>

  clickhouse_logging:
    content: |
      <clickhouse>
        <logger>
            <level>warning</level>
            <console>true</console>
        </logger>
        <query_thread_log remove="remove"/>
        <query_log remove="remove"/>
        <text_log remove="remove"/>
        <trace_log remove="remove"/>
        <metric_log remove="remove"/>
        <asynchronous_metric_log remove="remove"/>
        <session_log remove="remove"/>
        <part_log remove="remove"/>
        <latency_log remove="remove"/>
        <processors_profile_log remove="remove"/>
      </clickhouse>

  clickhouse_user_logging:
    content: |
      <clickhouse>
        <profiles>
          <default>
            <log_queries>0</log_queries>
            <log_query_threads>0</log_query_threads>
            <log_processors_profiles>0</log_processors_profiles>
          </default>
        </profiles>
      </clickhouse>
  • NGINX:
server {
    listen 80;
    server_name analytics.toes.ch;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name analytics.toes.ch;

    {{ssl_certificate_key}}
    {{ssl_certificate}}
    
    location ^~ /.well-known {
        auth_basic off;
        allow all;
        try_files $uri @reverse_proxy;
    }

    location /api/ {
        proxy_pass http://localhost:8801;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location / {
        proxy_pass http://localhost:8802;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
  • .env File:
# Domain and URL Configuration
DOMAIN_NAME=analytics.MYDOMAIN.ch
BASE_URL="https://${DOMAIN_NAME}"

# Authentication and Security
BETTER_AUTH_SECRET=THESECRETOFALLSECRETESIAMOBVIOUSLYNOTSHARING
DISABLE_SIGNUP=true

# Webserver Configuration
# Set to false to disable the built-in Caddy webserver
USE_WEBSERVER=false
# Host port mappings - these control how services are exposed
# Format: "host_binding:container_port" or "port:container_port"
HOST_BACKEND_PORT="8801:3001"
HOST_CLIENT_PORT="8802:3002"

# ClickHouse Database Configuration
CLICKHOUSE_DB=analytics
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=*****************************

# PostgreSQL Database Configuration
POSTGRES_DB=analytics
POSTGRES_USER=frog
POSTGRES_PASSWORD=*****************************

00RESEND_API_KEY=rs_XXXXXXX

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions