{"id":17969924,"url":"https://github.com/matoous/visigo","last_synced_at":"2025-09-10T10:37:42.755Z","repository":{"id":48832245,"uuid":"103634042","full_name":"matoous/visigo","owner":"matoous","description":"Unique site visits counter in Go","archived":false,"fork":false,"pushed_at":"2023-12-15T02:34:45.000Z","size":22,"stargazers_count":19,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-20T01:41:12.332Z","etag":null,"topics":["golang","hyperloglog","middleware","unique-visitors"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matoous.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2017-09-15T08:33:55.000Z","updated_at":"2024-01-17T16:25:01.000Z","dependencies_parsed_at":"2024-10-29T15:21:39.875Z","dependency_job_id":null,"html_url":"https://github.com/matoous/visigo","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matoous%2Fvisigo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matoous%2Fvisigo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matoous%2Fvisigo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matoous%2Fvisigo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matoous","download_url":"https://codeload.github.com/matoous/visigo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245444611,"owners_count":20616415,"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":["golang","hyperloglog","middleware","unique-visitors"],"created_at":"2024-10-29T15:01:27.734Z","updated_at":"2025-03-25T10:32:51.055Z","avatar_url":"https://github.com/matoous.png","language":"Go","readme":"# Visigo\n\n\n[![Build Status](https://github.com/matoous/visigo/workflows/Tests/badge.svg)](https://github.com/matoous/visigo/actions) \n[![Build Status](https://github.com/matoous/visigo/workflows/Lint/badge.svg)](https://github.com/matoous/visigo/actions) \n[![GoDoc](https://godoc.org/github.com/matoous/visigo?status.svg)](https://godoc.org/github.com/matoous/visigo)\n[![Go Report Card](https://goreportcard.com/badge/github.com/matoous/visigo)](https://goreportcard.com/report/github.com/matoous/visigo)\n[![GitHub issues](https://img.shields.io/github/issues/matoous/visigo.svg)](https://github.com/matoous/visigo/issues)\n[![License](https://img.shields.io/badge/license-MIT%20License-blue.svg)](https://github.com/matoous/visigo/LICENSE)\n\n\n**Visigo** is http middleware for page unique visits counting. It uses HyperLogLog as \na counter, so it's pretty fast.\n\n**Warning:** Visigo stores HyperLogLog++ in *map*, so this implementation\nshould be used only on smaller sites.\n\n## HyperLogLog++\n\n[HyperLogLog++ paper](http://research.google.com/pubs/pub40671.html)  \n[Google article about HyperLogLog++](https://research.neustar.biz/2013/01/24/hyperloglog-googles-take-on-engineering-hll/)\n\nFrom [Wikipedia](https://en.wikipedia.org/wiki/HyperLogLog)  \n\n\u003e HyperLogLog is an algorithm for the count-distinct problem, approximating the number of distinct elements in a multiset.\nCalculating the exact cardinality of a multiset requires an amount of memory proportional to the cardinality, which is impractical for very large data sets. Probabilistic cardinality estimators, such as the HyperLogLog algorithm, use significantly less memory than this, at the cost of obtaining only an approximation of the cardinality. The HyperLogLog algorithm is able to estimate cardinalities of \u003e 109 with a typical accuracy of 2%, using 1.5 kB of memory.\n HyperLogLog is an extension of the earlier LogLog algorithm, itself deriving from the 1984 Flajolet–Martin algorithm.\n\n## Install\n\nVia go get tool\n\n``` bash\n$ go get github.com/matoous/visigo\n```\n\n## Usage\n\n\n``` go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\n\t\"github.com/matoous/visigo\"\n)\n\nfunc main() {\n\thttp.Handle(\"/\", visigo.Counter(http.HandlerFunc(final)))\n\thttp.Handle(\"/total\", visigo.Counter(http.HandlerFunc(total)))\n\thttp.ListenAndServe(\":3000\", nil)\n}\n\nfunc final(w http.ResponseWriter, r *http.Request) {\n\tcount, _ := visigo.Visits(r)\n\tresponse := fmt.Sprintf(\"This page was viewed by %d unique visitors\", count)\n\tw.Write([]byte(response))\n}\n\nfunc total(w http.ResponseWriter, r *http.Request) {\n\tcount, _ := visigo.TotalVisits()\n\tresponse := fmt.Sprintf(\"This website had %d unique visitors in total\", count)\n\tw.Write([]byte(response))\n}\n```\n\n## Testing\n\n``` bash\n$ go test ./...\n```\n\n## Notice\n\nIf you use **Visigo** on your site or in your project, please let me know!\n\nIf you have any issues, just feel free and open it in this repository, thanks!\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatoous%2Fvisigo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatoous%2Fvisigo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatoous%2Fvisigo/lists"}