# cookieless nginx analytics

> Privacy-first nginx log analytics using HyperLogLog to deduplicate unique visitors without cookies or IP storage.

cookieless nginx analytics is a free AI agent skill on Agensi by synergieloc, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [synergieloc](https://www.agensi.io/creators/synergieloc)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Uses: 2
- Version: 1.0
- Last updated: 2026-10-18
- Security: scan passed (2026-10-18); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/cookieless-nginx-analytics
- Tags: llm-ops, nginx, python, analytics, gdpr, hyperloglog

## About this skill

Most self-hosted dashboards report wrong numbers because they ignore log rotation, fail to filter bots, or incorrectly sum unique visitors over time. Adding daily unique visitors together results in massive overcounting, while simple averages often decline as the measurement period grows. This tool provides a privacy-first way to measure real human traffic directly from nginx access logs without using cookies or third-party trackers.

### What it does
- **Unique visitor estimation** uses HyperLogLog sketches to calculate the cardinality of the union across any time window without storing IP addresses.
- **Bot filtering** excludes self-declared crawlers to prevent automated traffic from inflating page view counts by up to 15x.
- **Data accumulation** solves the 14-day log rotation limit by persisting daily summaries into a non-rotated JSON storage format.
- **GDPR compliance** ensures no personal data or IP addresses are retained, using non-reversible probabilistic sketches instead.
- **Multi-window reporting** calculates precise statistics for today, yesterday, the last 7 days, and the last 30 days.

### How it works
1. **Configure environment variables** for the nginx log path, the target site's URL pattern, and the JSON output destination.
2. **Execute the collection script** to process existing logs on disk and rebuild up to 14 days of historical data.
3. **Schedule an hourly cron job** to ensure "today's" statistics remain current throughout the day.
4. **Read the JSON output** from your frontend or dashboard to display deduplicated visitor counts and page views.

### Frameworks & tools
The core logic uses Python 3 with the `hyperloglog` library. It requires access to nginx `access_log` files, typically found in `/var/log/nginx/`.

### Why this beats prompting it yourself
Prompting an AI to count visitors usually results in a simple `grep` and `wc -l` script that ignores IP deduplication logic and log rotation. This skill implements specific mathematical sketches (HyperLogLog) that allow you to merge daily data into weekly or monthly totals without overcounting returning users.

### Use cases
- Replace Google Analytics with a server-side, cookie-free privacy solution.
- Fix inflated traffic reports caused by aggressive search engine crawlers.
- Audit actual site reach when monthly log totals seem mathematically impossible.
- Monitor server-side traffic for GDPR-sensitive applications.

### Known limitations
This skill only measures HTTP requests recorded in nginx logs. It cannot track client-side interactions like button clicks, scroll depth, or conversion funnels that do not trigger a page load.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the cookieless nginx analytics skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill prevent the overcounting of unique visitors compared to standard log parsers?

Standard log analysis often double-counts the same user across multiple days; this skill uses HyperLogLog algorithms to mathematically deduplicate unique visitors over any time window without ever storing their IP addresses.

### What are the technical requirements for an AI agent to use this skill?

This skill requires a Python 3 environment with access to your Nginx log directory; it is designed to be invoked by any AI agent capable of executing shell commands or Python scripts to manage reporting tasks.

### Can this skill distinguish between human visitors and search engine crawlers?

Yes, the skill includes a specialized filtering engine that identifies and excludes self-declared crawlers and bots, ensuring your analytics reflect real human engagement rather than automated traffic.

### Is this tool compliant with GDPR and other privacy regulations?

Since the tool converts raw log data into anonymized HyperLogLog sketches and never stores full IP addresses or cookies, it is inherently designed to meet strict GDPR and privacy-first data standards.

### What specific assets are included in this skill purchase?

The package includes the core HyperLogLog processing engine, the log rotation persistence logic, a configuration template for environment variables, and documentation for setting up the hourly automation.

### How does the skill handle data when Nginx rotates or deletes old log files?

Unlike basic scripts, this skill handles Nginx's 14-day log rotation by persisting daily summaries into a permanent JSON format, allowing you to track long-term trends without losing historical data.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
