{"id":19029928,"url":"https://github.com/statico/femtostats","last_synced_at":"2025-04-23T15:54:58.854Z","repository":{"id":59626827,"uuid":"537903953","full_name":"statico/femtostats","owner":"statico","description":"📊🌍 Super small, light, privacy-focused, self-hostable web statistics provider","archived":false,"fork":false,"pushed_at":"2025-03-05T06:05:13.000Z","size":532,"stargazers_count":20,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-18T01:47:27.197Z","etag":null,"topics":["analytics","google-analytics","pageviews","statistics","stats","tracking","tracking-pixels","webstats"],"latest_commit_sha":null,"homepage":"https://github.com/statico/femtostats","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/statico.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-09-17T18:57:45.000Z","updated_at":"2025-03-05T06:05:17.000Z","dependencies_parsed_at":"2024-05-12T02:24:48.715Z","dependency_job_id":"ad12b758-087e-4933-89d5-d17ad442bda1","html_url":"https://github.com/statico/femtostats","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statico%2Ffemtostats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statico%2Ffemtostats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statico%2Ffemtostats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statico%2Ffemtostats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statico","download_url":"https://codeload.github.com/statico/femtostats/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250467976,"owners_count":21435447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","google-analytics","pageviews","statistics","stats","tracking","tracking-pixels","webstats"],"created_at":"2024-11-08T21:15:49.950Z","updated_at":"2025-04-23T15:54:58.809Z","avatar_url":"https://github.com/statico.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# femtostats\n\nFemtostats is a lightweight, tiny, privacy-focused web statistics provider with no RDBMS requirement.\n\n[![build status](https://img.shields.io/github/actions/workflow/status/statico/femtostats/build.yml?branch=main\u0026style=flat-square)](https://ghcr.io/statico/femtostats)\n\n\u003cimg height=\"800\" alt=\"CleanShot 2022-09-25 at 12 43 28@2x\" src=\"https://user-images.githubusercontent.com/137158/192162253-11532bc6-9c5b-474b-95d3-f286e7aaa19b.png\"\u003e\n\n## Why?\n\n- Self-hostable\n- Easy setup with a single `\u003cscript\u003e` tag\n- Simple pageview and session tracking\n- Arbitrary client-side event tracking\n- Realtime visitor count\n- No external database requirement (uses SQLite)\n- Not blocked by common ad blockers and browsers\n- No storage of personally-identifable data (PII)\n- Collection of client-side performance stats and screen width\n- Geographic tracking with a free Maxmind account signup\n- Optional cookieless operation to abide by privacy laws\n\n## Why not use ........?\n\n| What                          | Why not?                                                                       |\n| ----------------------------- | ------------------------------------------------------------------------------ |\n| Google Analytics              | Blocked by ad blockers and feeds your site's data into the Google data machine |\n| CloudFlare Web Analytics      | Blocked by ad blockers                                                         |\n| Plausible                     | Self-hosting requires both additional Postgres and Clickhouse databases        |\n| Fathom Lite                   | The project is in maintenance-only mode and requires a Fathom account          |\n| Server logs                   | Doesn't record client information or sessions                                  |\n| CloudFront logs + S3 + Athena | Logs only get dumped once per day and querying requires writing raw SQL        |\n\n## Getting Started\n\n1. Host the image `ghcr.io/statico/femtostats` wherever you want.\n   - Check out the `docker-compose.yml` file in this repo as an example.\n   - See below instructions on creating a Maxmind account to resolve geographic location at the country level.\n   - Set a `PASSWORD` env var to protect your dashboard behind a password (the username is `admin`).\n   - Set a `DATA_DIR` env var to store the SQLite database and Maxmind database. (Default is `/tmp`.)\n1. Run `pnpm knex:migrate` to initialize the database.\n1. Include the tag `\u003cscript defer src=\"https://your-femtostats.com/data.js\"\u003e\u003c/script\u003e` on the pages you want to track.\n1. For custom event tracking, call `window.femtostats('event name')`\n\n### Enabling Country Resolution\n\nTo record which country the user has originated from, you need a geoip database. Femtostats will automatically download a free one from Maxmind and refresh it once a week if you do the following:\n\n1. Go to https://www.maxmind.com/ and register for a free account\n1. Under \"Manage License Keys\", get a license key\n1. Under \"Download Files\", scroll to the \"GeoLite2 Country\" row and click \"Get Permalinks\". Get the database URL (it will look like `https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country\u0026license_key=YOUR_LICENSE_KEY\u0026suffix=tar.gz`) and replace `YOUR_LICENSE_KEY` with your license key.\n1. Set this URL as an environment variable `MAXMIND_GEOLITE2_COUNTRY_URL`\n\n### Disabling Cookies\n\nBy default, Femtostats stores a simple cookie on the client to count unique users and user sessions. You can disable the use of cookies entirely by adding `data-cookies=\"false\"` to the `\u003cscript\u003e` tag you embed on your site. Sessions will still show in the dashboard, but without cookies, the definition of a session changes from \"a user's browser session\" to \"a single page view.\"\n\n### Other notes\n\nThe script tag instructions used to reference `script.js`, but uBlock appears to be [blocking that](https://github.com/uBlockOrigin/uAssets/blob/927dec7c9c60b6c1701d69ea9f8e5923644dd9dc/filters/privacy.txt#L376).\n\n## Development\n\nRequires Node.js 16+ and [pnpm](https://pnpm.io). Run `pnpm` and `pnpm install`.\n\nThe default database location is `/tmp/stats.db`. Run `pnpm knex:seed` to populate the database with some sample data.\n\nThis project uses [Next.js](https://nextjs.org/), [React](https://reactjs.org/), [SWR](https://swr.vercel.app/), [Recoil](https://recoiljs.org/), [Chakra UI](https://chakra-ui.com/), and [Chart.js](https://www.chartjs.org/).\n\n## Future Ideas\n\n- Use the [better-sqlite3](https://www.npmjs.com/package/better-sqlite3) driver\n- Support other databases, maybe, I dunno\n- Support UTM campaigns\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatico%2Ffemtostats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatico%2Ffemtostats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatico%2Ffemtostats/lists"}