{"id":18024006,"url":"https://github.com/lete114/visit-stat","last_synced_at":"2025-03-27T00:30:47.488Z","repository":{"id":41517376,"uuid":"486086930","full_name":"Lete114/Visit-Stat","owner":"Lete114","description":"Website visitor statistics","archived":false,"fork":false,"pushed_at":"2024-05-28T15:10:27.000Z","size":359,"stargazers_count":19,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-20T01:07:17.979Z","etag":null,"topics":["counter","free","javascript","mongodb","nodejs","site","statistics","visit","visit-stat","website"],"latest_commit_sha":null,"homepage":"https://visit-stat.vercel.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lete114.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}},"created_at":"2022-04-27T07:17:23.000Z","updated_at":"2024-05-25T10:02:06.000Z","dependencies_parsed_at":"2024-10-30T07:35:13.251Z","dependency_job_id":null,"html_url":"https://github.com/Lete114/Visit-Stat","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"034ba3704f3a69e8808a345178c593fc8164a32a"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lete114%2FVisit-Stat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lete114%2FVisit-Stat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lete114%2FVisit-Stat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lete114%2FVisit-Stat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lete114","download_url":"https://codeload.github.com/Lete114/Visit-Stat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245760563,"owners_count":20667886,"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":["counter","free","javascript","mongodb","nodejs","site","statistics","visit","visit-stat","website"],"created_at":"2024-10-30T07:11:38.636Z","updated_at":"2025-03-27T00:30:47.184Z","avatar_url":"https://github.com/Lete114.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Visit-Stat\n\n- Lightweight\n- Statistics `site_pv`, `site_uv`, `page_pv`, `page_uv`\n- Storages `Deta`, `MongoDB`, `Redis`\n- Support `ServerLess`\n\n## Free Storage\n\n- [Deta](https://deta.space)\n- [MongoDB](https://mongodb.com)\n- [Redis](https://upstash.com)\n\n## Free Deploy\n\n- [Deta](https://github.com/Lete114/Visit-Stat/tree/deta)\n- [Vercel](https://github.com/Lete114/Visit-Stat/tree/vercel)\n\n## Usage\n\n\u003e The following example uses the install dependency approach to deployment. You can just clone the repository and run `node start.js`.\n\n```bash\nmkdir visit-stat\ncd visit-stat\nnpm install visit-stat\n```\n\nCreate a new index.js\n\n```js\n// index.js\nrequire('visit-stat').server()\n\n// If is ServerLess\n// module.exports = require('visit-stat').main\n```\n\nAfter successful deployment, you can send requests through the front-end browser to perform access statistics\n\n\u003e support `GET` and `POST` requests\n\n```js\n// The unique identification of the statistics is determined by the referer in the request header.\n// If the referer is `https://example.com` then `{ \"site_pv\": 2, \"site_uv\": 1 }`will be returned\n// If referer is `https://example.com/post/xxxx.html` then `{ \"page_pv\": 2, \"page_uv\": 1 }`\n// Visits to the root of the site will return site statistics, and visits to sub-pages of the site will return page statistics\n\n// referer: https://example.com\n// You need to set referrerPolicy to get the web page referer correctly, if you don't set referrerPolicy, the referer you get will probably be the root of the website every time.\nfetch('http://localhost:6870', { referrerPolicy: 'no-referrer-when-downgrade' })\n  .then((r) =\u003e r.json())\n  .then(console.log)\n// =\u003e { \"site_pv\": 23, \"site_uv\": 1 }\n\n// referer: https://example.com/post/xxxx.html\nfetch('http://localhost:6870', { referrerPolicy: 'no-referrer-when-downgrade' })\n  .then((r) =\u003e r.json())\n  .then(console.log)\n// =\u003e { \"page_pv\": 3, \"page_uv\": 1 }\n\n// Bulk access to statistical information (Maximum 20 URLs, and the `domain` of these 20 URLs must be the same as the referer, otherwise they will be filtered)\nfetch('http://localhost:4200/visits', {\n  method: 'post',\n  body: JSON.stringify({ urls: ['https://example.com', 'https://example.com/post/xxxx.html'] })\n})\n  .then((r) =\u003e r.json())\n  .then(console.log)\n// =\u003e\n//[\n//  {\n//    \"url\": \"https://example.com\",\n//    \"site_pv\": 23,\n//    \"site_uv\": 1\n//  },\n//  {\n//    \"url\": \"https://example.com/post/xxxx.html\",\n//    \"page_pv\": 3,\n//    \"page_uv\": 1\n//  }\n// ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flete114%2Fvisit-stat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flete114%2Fvisit-stat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flete114%2Fvisit-stat/lists"}