Thought I’d lend a hand here as I just went through something similar with nginx. Basically, Ghost isn’t being told to include the required name=analytics_events query parameter in its analytics tracking requests. The traffic-analytics service requires this parameter to know which Tinybird datasource to send the data to.
To fix it you need to add a tinybird__tracker__endpoint in your .env file to include ?name=analytics_events, allowing Ghost to forward properly formatted requests to Tinybird.
So in my .env file I added this line after the “DOMAIN=” part:
tinybird__tracker__endpoint=https://mydomain.com/.ghost/analytics/api/v1/page_hit?name=analytics_events
In compose.yml in the traffic-analytics section, I added the relevant port:
...
expose:
- "3000"
ports:
- "3000:3000" # Add this line
Finally, in Nginx I added this block:
# Proxy Ghost analytics traffic to Traffic Analytics service
location ~ ^/.ghost/analytics/(.*)$ {
proxy_pass http://127.0.0.1:3000/$1$is_args$args;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_buffering off;
proxy_cache_bypass $http_upgrade;
}
Hope that helps someone!