{"id":18055712,"url":"https://github.com/evannotfound/vercount-react","last_synced_at":"2026-02-25T20:31:46.619Z","repository":{"id":259141608,"uuid":"876282911","full_name":"EvanNotFound/vercount-react","owner":"EvanNotFound","description":"The React component for Vercount, a simple website counter powered by NextJS.","archived":false,"fork":false,"pushed_at":"2025-03-05T17:17:43.000Z","size":165,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-01T16:26:01.693Z","etag":null,"topics":["nextjs","react","visitor-count","visitor-counter","website-counter"],"latest_commit_sha":null,"homepage":"https://vercount.one","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/EvanNotFound.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":"2024-10-21T17:51:48.000Z","updated_at":"2025-09-24T09:07:15.000Z","dependencies_parsed_at":"2025-04-11T02:00:43.008Z","dependency_job_id":"695c4cfd-08fa-43c0-9467-27b0bbd9b0df","html_url":"https://github.com/EvanNotFound/vercount-react","commit_stats":null,"previous_names":["evannotfound/vercount-react"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EvanNotFound/vercount-react","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvanNotFound%2Fvercount-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvanNotFound%2Fvercount-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvanNotFound%2Fvercount-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvanNotFound%2Fvercount-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EvanNotFound","download_url":"https://codeload.github.com/EvanNotFound/vercount-react/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvanNotFound%2Fvercount-react/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29838055,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T19:08:47.527Z","status":"ssl_error","status_checked_at":"2026-02-25T18:59:04.705Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["nextjs","react","visitor-count","visitor-counter","website-counter"],"created_at":"2024-10-31T01:11:36.415Z","updated_at":"2026-02-25T20:31:46.590Z","avatar_url":"https://github.com/EvanNotFound.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"right\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/-English-4A628A?style=for-the-badge\" alt=\"English\" /\u003e\n  \u003ca title=\"zh-CN\" href=\"README.zh.md\"\u003e  \u003cimg src=\"https://img.shields.io/badge/-%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87-545759?style=for-the-badge\" alt=\"简体中文\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\n![vercount react banner@3x](https://github.com/user-attachments/assets/a540dc18-8d92-4b46-a121-ad6580d3ef3d)\n\n# vercount-react\n\n**vercount-react** is a React hook designed for [Vercount](https://github.com/EvanNotFound/vercount), a fast and efficient website counter powered by Next.js and Redis. It provides real-time website traffic statistics while being reliable, fast, and secure.\n\nIf you want to use Vercount as plain JavaScript, check out the [vercount](https://github.com/EvanNotFound/vercount) repository.\n\n## Why Choose Vercount?\n\nVercount is designed to replace slower and less reliable counters like Busuanzi. Key features include:\n- **Speed**: Server response times under 10ms.\n- **Reliability**: Choose between a China-optimized version or Vercel's global CDN with 99.99% uptime.\n- **Accurate Tracking**: Uses POST requests for improved counting, avoiding the limitations of Referrer-based methods.\n- **Security**: Utilizes JSON callbacks to prevent CSRF attacks, moving away from vulnerable JSONP methods.\n- **Data Sync**: Automatic synchronization with Busuanzi data—no manual work required.\n- **Compatibility**: Seamless integration with existing Busuanzi tags.\n\n## Installation\n\nInstall `vercount-react` using your preferred package manager:\n\n```bash\n# With npm\nnpm install vercount-react\n\n# With pnpm\npnpm install vercount-react\n\n# With yarn\nyarn add vercount-react\n```\n\n## Usage\n\nTo retrieve traffic statistics for your site or page, import the `useVercount` hook from `vercount-react` and use it in your React components.\n\n### Example:\n\n```tsx\nimport { useVercount } from 'vercount-react'\n\nexport default function Home() {\n  const { sitePv, pagePv, siteUv } = useVercount()\n\n  return (\n    \u003cdiv\u003e\n      \u003ch1\u003eSite Page Views: {sitePv}\u003c/h1\u003e\n      \u003ch2\u003ePage Views: {pagePv}\u003c/h2\u003e\n      \u003ch2\u003eUnique Visitors: {siteUv}\u003c/h2\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\nIn this example:\n- `sitePv`: Total page views across the entire site.\n- `pagePv`: Page views for the current page.\n- `siteUv`: Unique visitors to the site.\n\n## Documentation\n\n### `useVercount` Hook\n\nThe `useVercount` hook is the core of `vercount-react`. It fetches traffic statistics for the site and page using Vercount’s backend. Here's a breakdown of how it works:\n\n```tsx\nconst { sitePv, pagePv, siteUv } = useVercount()\n```\n\n#### Return Values:\n- **sitePv** (`number`): The total number of page views across the entire website.\n- **pagePv** (`number`): The number of page views on the current page.\n- **siteUv** (`number`): The number of unique visitors to the website.\n\n[//]: # (### Advanced Configuration)\n\n[//]: # (#### Setting Custom Tags)\n\n[//]: # (You can add custom tags to display specific statistics on your website, as Vercount will automatically replace these tags. Here are some common tags that you can use to display statistics directly on your website:)\n\n[//]: # ()\n[//]: # (```html)\n\n[//]: # (\u003cscript defer src=\"https://cn.vercount.one/js\"\u003e\u003c/script\u003e)\n\n[//]: # ()\n[//]: # (Total Page Views: \u003cspan id=\"vercount_value_page_pv\"\u003eLoading\u003c/span\u003e times  )\n\n[//]: # (Total Site Views: \u003cspan id=\"vercount_value_site_pv\"\u003eLoading\u003c/span\u003e times  )\n\n[//]: # (Unique Visitors: \u003cspan id=\"vercount_value_site_uv\"\u003eLoading\u003c/span\u003e people)\n\n[//]: # (```)\n\n[//]: # (### Migrating from Busuanzi)\n\n[//]: # ()\n[//]: # (Vercount is fully compatible with Busuanzi’s tags. To migrate from Busuanzi:)\n\n[//]: # (1. Replace your existing Busuanzi script with the Vercount script:)\n\n[//]: # (   ```html)\n\n[//]: # (   \u003cscript defer src=\"https://cn.vercount.one/js\"\u003e\u003c/script\u003e)\n\n[//]: # (   ```)\n\n[//]: # (2. You can keep your existing Busuanzi tags or update them with Vercount-specific IDs for extended features.)\n\n[//]: # ()\n[//]: # (#### Example Busuanzi to Vercount Migration:)\n\n[//]: # (Replace:)\n\n[//]: # (```html)\n\n[//]: # (\u003cscript defer src=\"https://busuanzi.ibruce.info/busuanzi/2.0/busuanzi.pure.js\"\u003e\u003c/script\u003e)\n\n[//]: # (```)\n\n[//]: # (With:)\n\n[//]: # (```html)\n\n[//]: # (\u003cscript defer src=\"https://cn.vercount.one/js\"\u003e\u003c/script\u003e)\n\n[//]: # (```)\n\n[//]: # ()\n[//]: # (Existing tags like:)\n\n[//]: # (```html)\n\n[//]: # (\u003cspan id=\"busuanzi_value_page_pv\"\u003eLoading\u003c/span\u003e 次)\n\n[//]: # (```)\n\n[//]: # ()\n[//]: # (Can be updated to:)\n\n[//]: # (```html)\n\n[//]: # (\u003cspan id=\"vercount_value_page_pv\"\u003eLoading\u003c/span\u003e 次)\n\n[//]: # (```)\n\n[//]: # ()\n[//]: # (### Tracking Methodology)\n\n[//]: # ()\n[//]: # (- **Page Views \u0026#40;PV\u0026#41;**: Every page visit increments this value by one.)\n\n[//]: # (- **Unique Visitors \u0026#40;UV\u0026#41;**: Calculated based on the user's browser UserAgent and IP address, providing a more accurate count than traditional referrer-based methods.)\n\n[//]: # ()\n[//]: # (## Quick Start)\n\n[//]: # ()\n[//]: # (Add one of the following scripts to your website to start tracking:)\n\n[//]: # ()\n[//]: # (### For China-Optimized Access:)\n\n[//]: # (```html)\n\n[//]: # (\u003cscript defer src=\"https://cn.vercount.one/js\"\u003e\u003c/script\u003e)\n\n[//]: # (```)\n\n[//]: # ()\n[//]: # (### For Global Access:)\n\n[//]: # (```html)\n\n[//]: # (\u003cscript defer src=\"https://events.vercount.one/js\"\u003e\u003c/script\u003e)\n\n[//]: # (```)\n\n[//]: # ()\n[//]: # (After adding the script, you can use tags to display the stats, such as:)\n\n[//]: # ()\n[//]: # (```html)\n\n[//]: # (Total Page Views: \u003cspan id=\"vercount_value_page_pv\"\u003eLoading\u003c/span\u003e times)\n\n[//]: # (Total Site Views: \u003cspan id=\"vercount_value_site_pv\"\u003eLoading\u003c/span\u003e times)\n\n[//]: # (Unique Visitors: \u003cspan id=\"vercount_value_site_uv\"\u003eLoading\u003c/span\u003e people)\n\n[//]: # (```)\n\n## Support the Project\n\nVercount is a community-driven project, and your contributions help sustain and enhance it. Visit my [donation page](https://evannotfound.com/sponsor) to support the project, or check out my other initiatives.\n\n---\n\nFor additional information, visit the [Vercount official website](https://vercount.one).\n\n## Disclaimer\n\nAll rights reserved by EvanNotFound.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevannotfound%2Fvercount-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevannotfound%2Fvercount-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevannotfound%2Fvercount-react/lists"}