{"id":22122084,"url":"https://github.com/swetrix/swetrix-nextjs","last_synced_at":"2025-07-28T19:32:21.785Z","repository":{"id":62354985,"uuid":"488377625","full_name":"Swetrix/swetrix-nextjs","owner":"Swetrix","description":"Swetrix Tracking integration for Next.js","archived":false,"fork":false,"pushed_at":"2022-05-03T23:17:57.000Z","size":9,"stargazers_count":15,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T09:02:34.420Z","etag":null,"topics":["analytics","nextjs","privacy","selfhosted","tracking","web-analytics"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@swetrix/nextjs","language":"TypeScript","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/Swetrix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":"https://ko-fi.com/andriir"}},"created_at":"2022-05-03T22:13:01.000Z","updated_at":"2024-09-12T20:27:21.000Z","dependencies_parsed_at":"2022-10-31T10:49:08.073Z","dependency_job_id":null,"html_url":"https://github.com/Swetrix/swetrix-nextjs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Swetrix/swetrix-nextjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swetrix%2Fswetrix-nextjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swetrix%2Fswetrix-nextjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swetrix%2Fswetrix-nextjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swetrix%2Fswetrix-nextjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Swetrix","download_url":"https://codeload.github.com/Swetrix/swetrix-nextjs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swetrix%2Fswetrix-nextjs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267574901,"owners_count":24110077,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["analytics","nextjs","privacy","selfhosted","tracking","web-analytics"],"created_at":"2024-12-01T15:17:17.730Z","updated_at":"2025-07-28T19:32:21.432Z","avatar_url":"https://github.com/Swetrix.png","language":"TypeScript","funding_links":["https://ko-fi.com/andriir"],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://swetrix.com/assets/logo_blue.svg\" alt=\"\" height=\"100\" /\u003e\n\n# Swetrix Next.js integration\nOfficial [Swetrix Analytics](https://swetrix.com/?ref=github-swetrix-nextjs) integration for Next.js.\n\n# Integration\n\n### Install\n\nRun the following command to install in your project:\n\n```\nnpm install @swetrix/nextjs\n```\n\nOr with yarn:\n\n```\nyarn add @swetrix/nextjs\n```\n\n### Basic usage\n\nYou can now import, and use the Swetrix hook on your project:\n\n```javascript\n// ./pages/_app.js\n\nimport { useSwetrix } from '@swetrix/nextjs'\n\nfunction YourApp({ Component, pageProps }) {\n  useSwetrix('YOUR_PROJECT_ID')\n\n  return \u003cComponent {...pageProps} /\u003e\n}\n\nexport default YourApp\n```\n\n### Debug-mode\n\nWhen developing in localhost, Swetrix does not send events to avoid using your quota. \\\nYou can enable debug mode to send events when testing things locally. It will also log messages to console.\n\n```javascript\n// ./pages/_app.js\n\nimport { useSwetrix } from '@swetrix/nextjs'\n\nfunction YourApp({ Component, pageProps }) {\n  useSwetrix('YOUR_SITE_ID', {\n    debug: true\n  })\n\n  return \u003cComponent {...pageProps} /\u003e\n}\n\nexport default YourApp\n```\n\n### Advanced options\n`useSwetrix` hook accepts 3 parameters: `PID`, `initOptions`, `pageViewsOptions`. \\\nSee our [documentation](https://swetrix.com/docs) page for more details. \\\nYou can always [contact](https://swetrix.com/contact) us in case of any questions! :)\n\n# Contribution\n\nFeel free to contribute to the source code by opening a pull requests. \\\nFor any questions, you can open an issue ticket, refer to our [FAQs](https://swetrix.com/#faq) page or reach us at contact@swetrix.com \\\n\n# Selfhosted API\nIf you are selfhosting the [Swetrix-API](https://github.com/Swetrix/swetrix-api), be sure to point the `apiUrl` parameter to: `https://yourapiinstance.com/log`\n\n# Donate\nYou can support the project by donating us at https://ko-fi.com/andriir \\\nWe can only run our services by once again asking for your financial support!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswetrix%2Fswetrix-nextjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswetrix%2Fswetrix-nextjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswetrix%2Fswetrix-nextjs/lists"}