{"id":20995100,"url":"https://github.com/blackboxvision/next-google-analytics","last_synced_at":"2025-05-14T21:31:01.842Z","repository":{"id":85769417,"uuid":"383765470","full_name":"BlackBoxVision/next-google-analytics","owner":"BlackBoxVision","description":"🚀 Integrate Google Analytics in Next.js with ease","archived":false,"fork":false,"pushed_at":"2023-10-16T03:49:03.000Z","size":4008,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-25T21:20:20.265Z","etag":null,"topics":["google","google-analytics","nextjs"],"latest_commit_sha":null,"homepage":"","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/BlackBoxVision.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}},"created_at":"2021-07-07T10:51:04.000Z","updated_at":"2023-11-24T23:06:31.000Z","dependencies_parsed_at":"2024-01-23T17:41:48.916Z","dependency_job_id":"472179e6-dbec-4f1d-999e-3a454749523b","html_url":"https://github.com/BlackBoxVision/next-google-analytics","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"45b29552845d5ef270fbdb2d0e3b025d065eea78"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackBoxVision%2Fnext-google-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackBoxVision%2Fnext-google-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackBoxVision%2Fnext-google-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackBoxVision%2Fnext-google-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlackBoxVision","download_url":"https://codeload.github.com/BlackBoxVision/next-google-analytics/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254230811,"owners_count":22036247,"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":["google","google-analytics","nextjs"],"created_at":"2024-11-19T07:21:36.830Z","updated_at":"2025-05-14T21:30:56.822Z","avatar_url":"https://github.com/BlackBoxVision.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Next Google Analytics [![npm version](https://badge.fury.io/js/%40blackbox-vision%2Fnext-google-analytics.svg)](https://badge.fury.io/js/%40blackbox-vision%2Fnext-google-analytics) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)\n\n:rocket: Integrate Google Analytics in next.js with ease\n\n## Installation\n\n### NPM\n\n```bash\nnpm i @blackbox-vision/next-google-analytics\n```\n\n### YARN\n\n```bash\nyarn add @blackbox-vision/next-google-analytics\n```\n\n## Integration Steps\n\n1. Generate a Google Analytics account if you don't have one.\n\n2. Get the Google Analytics tracking ID.\n\n3. Create a `.env.local` with following content:\n\n```bash\nNEXT_PUBLIC_GOOGLE_ANALYTICS=your_tracking_id\n```\n\n3. Create a custom `app` and add the following contents:\n\n```js\nimport { GoogleAnalytics } from '@blackbox-vision/next-google-analytics';\n\nfunction MyApp({ Component, pageProps }) {\n  return (\n    \u003c\u003e\n      \u003cGoogleAnalytics id={process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS} /\u003e\n      \u003cComponent {...pageProps} /\u003e\n    \u003c/\u003e\n  );\n}\n\nexport default MyApp\n```\n\n## Track events\n\nYou can track custom events with this API by doing the following:\n\n```js\nimport { googleAnalytics } from \"@blackbox-vision/next-google-analytics\";\n\ngoogleAnalytics.event(\"my_event\", {\n  my_param: \"xyz\",\n});\n```\n\n## Compatibility\n\nWe're supporting next.js v11 only for now, but we've a `GoogleAnalyticsLegacy` component in the works and intentions to support older versions of next.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackboxvision%2Fnext-google-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblackboxvision%2Fnext-google-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackboxvision%2Fnext-google-analytics/lists"}