back to home

alexfernandez / librecounter

Free and open website statistics

122 stars
7 forks
1 issues
JavaScriptCSSDockerfile

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing alexfernandez/librecounter in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/alexfernandez/librecounter)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

LibreCounter Stats Free, libre and open website statistics. GDPR compliant: no cookies, no tracking done in the browser, no IP addresses stored, no marketing or advertising done (or even possible). LibreCounter provides website traffic analysis and statistics for free at librecounter.org. How to Use Simply add the following snippet to your website, in all pages that you want analyzed: After that stats will be collected for every page view, and users clicking on the logo will be taken to [https://librecounter.org/[site]/show](https://librecounter.org/[site]/show) replacing with your domain name. Stats will be public for all your visitors to see. That is it! No configuration needed on the server at all. You can see an example on the author's blog. Technical details: the is added to make sure that the browser sends the whole page URL to the server, otherwise sometimes it only sends the website (as ) so LibreCounter cannot know which page the user is visiting. There is an option to hide stats from the home page, using . Keep in mind that stats are still open for anyone that knows that you are using it, by following the link to https://librecounter.org/[example.org]/show. There is currently no way to make the stats private. If you want to hide stats for a sensitive domain (like an integration domain you don't want to show), please let the author know to add it to the hide list so that stats are not stored at all. There are a host of visualiation options on the official website. API The API allows you to count visits and to get stats. If you want to count a visit but don't want to add an image, or just cannot, you can use the endpoint . For instance: https://librecounter.org/count?url=http://example.org/mypage&userAgent=roboto/1.0 Invoking this endpoint will count as a visit to the site , page , with userAgent . You can in fact use whatever programming language to invoke the endpoint, even a simple will do: Be sure to URL-encode the URL and user agent parameters or they will be chopped up as part of the query string. Get stats for your site. Replace with the domain for your site like . For instance: https://librecounter.org/example.org/siteStats Parameters: • : number of last days to get, default 30. Deprecated and removed in v2.0: this API call was broken. The Project It's a simple project with less than 1000 lines of code on 2024-01-14. It uses the free IP database from Maxmind via , and the awesome package . No data is leaked outside as all lookups are done locally. Server Installation Using Docker To run your own instance with Docker: The application will be available at . Database will be persisted in the directory. To view logs: To stop: Using Node.js Directly Alternatively, you can run without Docker: That should do it! For no-hassle use please use the official website. Server Configuration Configuration can be set via environment variables: • : path to SQLite database to use, default value: . • : comma-separated list of domains to hide: not store or show stats at all. Default value: empty string. When running directly with Node.js, you can create a file at the root of the project with the variables in the usual dotenv format. When running with Docker, environment variables are configured in . Analytics, Counter or Tracking? LibreCounter is a small step beyond the old website counters that kept track of how many people had visited to your website. It stores analytics for those visitors: by day, page, country of origin, browser and OS. LibreCounter performs **no tracking**: it does not keep track of what visitors did on your site, just counts independent visits to each page. Personal information is not correlated between page visits. In particular, user agents and IP addresses and user agents are not stored at all. (But see Tracking for more specific info.) Data Stored In case you want to audit what data is stored per page view, all technical details are in the class : • day of the view (as 2023-10-06), • country of origin (as read from the IP address by geoip-lite), • site and page visited, • type of device (desktop, smartphone, tablet..), • browser used (Chrome, Firefox, Safari...), • operating system (Windows, GNU/Linux, Android...), • and platform (x64, x32, amd...). That is it! The package geoip-lite is used for reading the country locally: no data leaves the server. For device identification the package node-device-detector is used, again locally so no data leaves the server. Help Wanted If you want the package to support your favorite feature please open a merge request. Known Limitations Some characters can be modified in pages when displayed: the small dollar sign is replaced by the regular dollar sign , and the leading dot by the regular dot `.'. This was done originally to sidestep limitations in MongoDB field names, and has not been changed yet. Rationale The idea of creating free and open stats came after the GDPR: it became quite obnoxious to add something like Google Analytics to your webpage, with the cookie warning. Also Google Analytics became more and more obnoxious itself, to the point where it looks like Google is not interested in having people use their free product. Other tools are usually expensive, and still have in-browser tracking. Sadly neither GitHub nor Gitlab provide server-side analytics. LibreCounter does server-side analytics, no cookies, free software, open for everyone to use. Guarantees The code is running on a private server using Linode (now Akamai). There are no guarantees of any kind: I intend to provide this service to the community as long as I am able to do it. However, if your use case requires it I may provide a full code audit to verify the running code. You can bring up your own instance since the code is completely free. Disclaimer Since you are just adding an external image you should not have any GDPR obligations, the operator of the private server does (i.e. myself). The ePrivac…