{"id":16629030,"url":"https://github.com/bradgarropy/next-google-analytics","last_synced_at":"2025-09-11T02:05:21.431Z","repository":{"id":44610024,"uuid":"455278938","full_name":"bradgarropy/next-google-analytics","owner":"bradgarropy","description":"📊 google analytics for next.js","archived":false,"fork":false,"pushed_at":"2022-02-15T19:19:58.000Z","size":745,"stargazers_count":27,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-25T06:48:48.463Z","etag":null,"topics":["eslint","google","google-analytics","jest","next","prettier","react","typescript"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/@bradgarropy/next-google-analytics","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/bradgarropy.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-03T18:20:03.000Z","updated_at":"2025-02-03T05:16:25.000Z","dependencies_parsed_at":"2022-09-17T14:00:32.307Z","dependency_job_id":null,"html_url":"https://github.com/bradgarropy/next-google-analytics","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":"bradgarropy/react-library-starter","purl":"pkg:github/bradgarropy/next-google-analytics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradgarropy%2Fnext-google-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradgarropy%2Fnext-google-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradgarropy%2Fnext-google-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradgarropy%2Fnext-google-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bradgarropy","download_url":"https://codeload.github.com/bradgarropy/next-google-analytics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradgarropy%2Fnext-google-analytics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274563747,"owners_count":25308471,"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-09-11T02:00:13.660Z","response_time":74,"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":["eslint","google","google-analytics","jest","next","prettier","react","typescript"],"created_at":"2024-10-12T04:39:05.429Z","updated_at":"2025-09-11T02:05:21.413Z","avatar_url":"https://github.com/bradgarropy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📊 next google analytics\n\n[![version][version-badge]][npm]\n[![downloads][downloads-badge]][npm]\n[![size][size-badge]][bundlephobia]\n[![github actions][github-actions-badge]][github-actions]\n[![coverage][codecov-badge]][codecov]\n[![typescript][typescript-badge]][typescript]\n[![contributing][contributing-badge]][contributing]\n[![contributors][contributors-badge]][contributors]\n[![discord][discord-badge]][discord]\n\n_[Google Analytics 4][ga4] for [Next.js][nextjs]._\n\n## 📦 Installation\n\nThis package is hosted on [`npm`][npm].\n\n```bash\nnpm install @bradgarropy/next-google-analytics\n```\n\n## 🥑 Usage\n\nThis component integrates [Google Analytics 4][ga4] into your [Next.js][nextjs] website. It downloads and initializes the `gtag` script, and no further setup is required. In order to work, this component must be placed in the `pages/_app.js` file.\n\n```jsx\n// pages/_app.js\nimport GoogleAnalytics from \"@bradgarropy/next-google-analytics\"\n\nconst App = ({Component, pageProps}) =\u003e {\n    return (\n        \u003c\u003e\n            \u003cGoogleAnalytics measurementId=\"G-XXXXXXXXXX\" /\u003e\n            \u003cComponent {...pageProps} /\u003e\n        \u003c/\u003e\n    )\n}\n```\n\nTo ensure that Google Analytics is working, you can check a few things.\n\n1. A network request was made to `https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX`.\n2. `window.dataLayer` exists and includes your Measurement ID.\n3. When you navigate your site, items are added to the `window.dataLayer` array.\n\n## 📖 API Reference\n\n### `\u003cGoogleAnalytics\u003e`\n\n| Name            | Required | Default | Example          | Description                                        |\n| :-------------- | :------: | :-----: | :--------------- | :------------------------------------------------- |\n| `measurementId` |  `true`  |         | `\"G-XXXXXXXXXX\"` | Google Analytics [Measurement ID][measurement-id]. |\n\nThe example below shows how to use the component.\n\n```jsx\n\u003cGoogleAnalytics measurementId=\"G-XXXXXXXXXX\" /\u003e\n```\n\n## ❔ Questions\n\n🐛 report bugs by filing [issues][issues]  \n📢 provide feedback with [issues][issues] or on [twitter][twitter]  \n🙋🏼‍♂️ use my [ama][ama] or [twitter][twitter] to ask any other questions\n\n## ✨ contributors\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://bradgarropy.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/11336745?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eBrad Garropy\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/bradgarropy/next-google-analytics/commits?author=bradgarropy\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/bradgarropy/next-google-analytics/commits?author=bradgarropy\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"https://github.com/bradgarropy/next-google-analytics/commits?author=bradgarropy\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"#infra-bradgarropy\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n[codecov]: https://app.codecov.io/gh/bradgarropy/next-google-analytics\n[contributing]: https://github.com/bradgarropy/next-google-analytics/blob/master/contributing.md\n[contributors]: #-contributors\n[npm]: https://www.npmjs.com/package/@bradgarropy/next-google-analytics\n[codecov-badge]: https://img.shields.io/codecov/c/github/bradgarropy/next-google-analytics?style=flat-square\n[version-badge]: https://img.shields.io/npm/v/@bradgarropy/next-google-analytics.svg?style=flat-square\n[downloads-badge]: https://img.shields.io/npm/dt/@bradgarropy/next-google-analytics?style=flat-square\n[contributing-badge]: https://img.shields.io/badge/PRs-welcome-success?style=flat-square\n[contributors-badge]: https://img.shields.io/github/all-contributors/bradgarropy/next-google-analytics?style=flat-square\n[issues]: https://github.com/bradgarropy/next-google-analytics/issues\n[twitter]: https://twitter.com/bradgarropy\n[ama]: https://bradgarropy.com/ama\n[bundlephobia]: https://bundlephobia.com/result?p=@bradgarropy/next-google-analytics\n[size-badge]: https://img.shields.io/bundlephobia/minzip/@bradgarropy/next-google-analytics?style=flat-square\n[github-actions]: https://github.com/bradgarropy/next-google-analytics/actions\n[github-actions-badge]: https://img.shields.io/github/workflow/status/bradgarropy/next-google-analytics/%F0%9F%9A%80%20release?style=flat-square\n[typescript]: https://www.typescriptlang.org/dt/search?search=%40bradgarropy%2Fnext-google-analytics\n[typescript-badge]: https://img.shields.io/npm/types/@bradgarropy/next-google-analytics?style=flat-square\n[discord]: https://bradgarropy.com/discord\n[discord-badge]: https://img.shields.io/discord/748196643140010015?style=flat-square\n[ga4]: https://analytics.google.com\n[nextjs]: https://nextjs.org\n[measurement-id]: https://www.youtube.com/watch?v=eWpTwBO9bNg\u0026t=27s\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradgarropy%2Fnext-google-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbradgarropy%2Fnext-google-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradgarropy%2Fnext-google-analytics/lists"}