{"id":28281559,"url":"https://github.com/phantomstudios/react-gtm","last_synced_at":"2026-03-01T12:31:50.753Z","repository":{"id":38538267,"uuid":"354263904","full_name":"phantomstudios/react-gtm","owner":"phantomstudios","description":"A lightweight React library to implement custom Google Tag Manager events.","archived":false,"fork":false,"pushed_at":"2025-11-17T17:04:58.000Z","size":1022,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-17T17:29:40.180Z","etag":null,"topics":["googletagmanager","gtm","lightweight","react","tagmanager","typescipt"],"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/phantomstudios.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-04-03T10:37:19.000Z","updated_at":"2025-11-17T15:33:54.000Z","dependencies_parsed_at":"2025-07-01T11:34:09.010Z","dependency_job_id":"1f33b5f8-0d46-4bdf-b227-877a912452b4","html_url":"https://github.com/phantomstudios/react-gtm","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/phantomstudios/react-gtm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantomstudios%2Freact-gtm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantomstudios%2Freact-gtm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantomstudios%2Freact-gtm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantomstudios%2Freact-gtm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phantomstudios","download_url":"https://codeload.github.com/phantomstudios/react-gtm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantomstudios%2Freact-gtm/sbom","scorecard":{"id":730570,"data":{"date":"2025-08-11","repo":{"name":"github.com/phantomstudios/react-gtm","commit":"b878a58883ed82ee2525e57c86980d0435e0461a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":3,"reason":"4 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmpublish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/phantomstudios/react-gtm/npmpublish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmpublish.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/phantomstudios/react-gtm/npmpublish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ossar-analysis.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/phantomstudios/react-gtm/ossar-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ossar-analysis.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/phantomstudios/react-gtm/ossar-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ossar-analysis.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/phantomstudios/react-gtm/ossar-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/phantomstudios/react-gtm/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/phantomstudios/react-gtm/test.yml/master?enable=pin","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned","Info:   2 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":8,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/npmpublish.yml:12","Info: jobLevel 'contents' permission set to 'read': .github/workflows/ossar-analysis.yml:22","Info: jobLevel 'contents' permission set to 'read': .github/workflows/test.yml:10","Warn: no topLevel permission defined: .github/workflows/npmpublish.yml:1","Warn: no topLevel permission defined: .github/workflows/ossar-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":5,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'master'","Warn: 'stale review dismissal' is disabled on branch 'master'","Warn: required approving review count is 1 on branch 'master'","Info: codeowner review is required on branch 'master'","Warn: 'last push approval' is disabled on branch 'master'","Warn: no status checks found to merge onto branch 'master'","Info: PRs are required in order to make changes on branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":2,"reason":"SAST tool is not run on all commits -- score normalized to 2","details":["Warn: 7 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T14:17:49.410Z","repository_id":38538267,"created_at":"2025-08-22T14:17:49.410Z","updated_at":"2025-08-22T14:17:49.410Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29969243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T11:43:06.159Z","status":"ssl_error","status_checked_at":"2026-03-01T11:43:03.887Z","response_time":124,"last_error":"SSL_read: 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":["googletagmanager","gtm","lightweight","react","tagmanager","typescipt"],"created_at":"2025-05-21T12:13:14.629Z","updated_at":"2026-03-01T12:31:50.718Z","avatar_url":"https://github.com/phantomstudios.png","language":"TypeScript","readme":"# @phntms/react-gtm\n\n[![NPM version][npm-image]][npm-url]\n[![Actions Status][ci-image]][ci-url]\n[![PR Welcome][npm-downloads-image]][npm-downloads-url]\n\nA lightweight React library to implement custom Google Tag Manager events.\n\n## Introduction\n\nDesigned to use and extend [Google Analytics 4](https://support.google.com/analytics/answer/10089681?hl=en). **Note**: If upgrading from react-gtm `0.0.6` or older, or currently using an older version of Google Analytics, you'll need to [upgrade](https://support.google.com/analytics/answer/9744165?hl=en). This library is also SSR safe and does not break when used without window existing. This package is intended to be used with React / older Next.JS apps, for Next.JS 11 and above we recommend using [@phntms/next-gtm](https://www.npmjs.com/package/@phntms/next-gtm).\n\n## Installation\n\nInstall this package with `npm`.\n\n```bash\nnpm i @phntms/react-gtm\n```\n\n## Usage\n\n### \u0026lt;TrackingHeadScript /\u003e\n\n| Property    | Type      | Default   | Notes                                                                                                     |\n| ----------- | --------- | --------- | --------------------------------------------------------------------------------------------------------- |\n| **id**      | `string`  | undefined | ID that uniquely identifies GTM Container. Example format: `GTM-xxxxxx`.                                  |\n| **disable** | `boolean` | false     | Used to disable tracking events. Use if you want user to consent to being tracked before tracking events. |\n\nTo initialize GTM, add `TrackingHeadScript` to the `head` of the page.\n\nExample initialization in Next.js:\n\n```JSX\nimport Document, {\n  Html,\n  Head,\n  Main,\n  NextScript,\n} from \"next/document\";\nimport { TrackingHeadScript } from \"@phntms/react-gtm\";\n\nconst GA_TRACKING_ID = process.env.NEXT_PUBLIC_GA_TRACKING_ID || \"\";\n\nexport default class MyDocument extends Document {\n  render = () =\u003e (\n    \u003cHtml\u003e\n      \u003cHead\u003e\n        \u003cTrackingHeadScript id={GA_TRACKING_ID} /\u003e\n      \u003c/Head\u003e\n      \u003cbody\u003e\n        \u003cMain /\u003e\n        \u003cNextScript /\u003e\n      \u003c/body\u003e\n    \u003c/Html\u003e\n  );\n}\n```\n\n**Note**: If used alongside any cookie consent scripts, `\u003cTrackingHeadScript /\u003e` must be placed after.\n\n### trackEvent()\n\n| Parameter | Type                 | Default   | Notes                                           |\n| --------- | -------------------- | --------- | ----------------------------------------------- |\n| props     | `EventTrackingProps` | undefined | Custom tracking event to push to GTM container. |\n\nExample of a basic tracking event:\n\n```javascript\nimport { trackEvent } from \"@phntms/react-gtm\";\n\ntrackEvent({\n  event: \"customEvent\",\n  data: {\n    action: \"Click - To: https://phantom.land/\",\n    category: \"CTA\",\n    label: \"Click\",\n  },\n});\n```\n\n### enableTracking()\n\n| Parameter  | Type      | Default   | Notes                                                               |\n| ---------- | --------- | --------- | ------------------------------------------------------------------- |\n| **id**     | `string`  | undefined | Same ID used in `TrackingHeadScript`. Example format: `GTM-xxxxxx`. |\n| **enable** | `boolean` | true      | Used to enable or disable tracking events.                          |\n\n**Note**: This _should_ only be used if needed, for example after user has consented to being tracked. You _shouldn't_ need to toggle this in normal usage.\n\n### EventDataProps\n\n| Parameter | Type             | Default       | Required | Notes                                                                                                                                     |\n| --------- | ---------------- | ------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |\n| event     | `string`         | \"customEvent\" | No       | Custom GTM event name, defaults to `customEvent`.                                                                                         |\n| data      | `EventDataProps` | undefined     | No       | Supports any value(s) in the format `[key: string]: any`. Example of recommended properties to include; `action`, `category` and `label`. |\n\n### window.dataLayer\n\nThis library extends `window` and exposes the `window.dataLayer` GTM container object.\n\n## Further Resources\n\nUseful resource for implementing custom GTM events:\n\n- [Omnibug](https://chrome.google.com/webstore/detail/omnibug/bknpehncffejahipecakbfkomebjmokl?hl=en) - Chrome browser extension to decode and display outgoing GTM events from within Inspect Element.\n\n## 🍰 Contributing\n\nWant to get involved, or found an issue? Please contribute using the GitHub Flow. Create a branch, add commits, and open a Pull Request or submit a new issue.\n\nPlease read `CONTRIBUTING` for details on our `CODE_OF_CONDUCT`, and the process for submitting pull requests to us!\n\n[npm-image]: https://img.shields.io/npm/v/@phntms/react-gtm.svg?style=flat-square\u0026logo=react\n[npm-url]: https://npmjs.org/package/@phntms/react-gtm\n[npm-downloads-image]: https://img.shields.io/npm/dm/@phntms/react-gtm.svg\n[npm-downloads-url]: https://npmcharts.com/compare/@phntms/react-gtm?minimal=true\n[ci-image]: https://github.com/phantomstudios/react-gtm/workflows/Test/badge.svg\n[ci-url]: https://github.com/phantomstudios/react-gtm/actions\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphantomstudios%2Freact-gtm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphantomstudios%2Freact-gtm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphantomstudios%2Freact-gtm/lists"}