{"id":21272744,"url":"https://github.com/jooy2/gtag-ga","last_synced_at":"2025-10-09T21:34:04.021Z","repository":{"id":65969809,"uuid":"603700053","full_name":"jooy2/gtag-ga","owner":"jooy2","description":"📊 Google Analytics 4 (gtag.js) for NodeJS ES Module. Simple installation to send page views or event tracking.","archived":false,"fork":false,"pushed_at":"2024-01-01T08:32:45.000Z","size":407,"stargazers_count":13,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-07T23:13:49.352Z","etag":null,"topics":["analytics","google-analytics","google-analytics-4","google-tag-manager","gtag","gtm","npm-module","tracking","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/gtag-ga","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/jooy2.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"jooy2","custom":["https://jooy2.com/donate"]}},"created_at":"2023-02-19T10:15:45.000Z","updated_at":"2024-09-07T02:50:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"a086c26d-f89c-4c7c-8954-86502900d6bc","html_url":"https://github.com/jooy2/gtag-ga","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"4c25b35fe41d3400c764b8a27a7379a336fa3e2a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jooy2%2Fgtag-ga","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jooy2%2Fgtag-ga/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jooy2%2Fgtag-ga/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jooy2%2Fgtag-ga/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jooy2","download_url":"https://codeload.github.com/jooy2/gtag-ga/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225700964,"owners_count":17510448,"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":["analytics","google-analytics","google-analytics-4","google-tag-manager","gtag","gtm","npm-module","tracking","typescript"],"created_at":"2024-11-21T09:09:04.462Z","updated_at":"2025-10-09T21:33:58.983Z","avatar_url":"https://github.com/jooy2.png","language":"TypeScript","funding_links":["https://github.com/sponsors/jooy2","https://jooy2.com/donate"],"categories":[],"sub_categories":[],"readme":"# 📊 gtag-ga\n\nGoogle Analytics 4 (gtag.js) for Node.js ES Module. Simple installation to send page views or event tracking.\n\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jooy2/gtag-ga/blob/main/LICENSE) ![Programming Language Usage](https://img.shields.io/github/languages/top/jooy2/gtag-ga) ![Commit Count](https://img.shields.io/github/commit-activity/y/jooy2/gtag-ga) [![npm downloads](https://img.shields.io/npm/dm/gtag-ga.svg)](https://www.npmjs.com/package/gtag-ga) [![npm latest package](https://img.shields.io/npm/v/gtag-ga/latest.svg)](https://www.npmjs.com/package/gtag-ga) ![minified size](https://img.shields.io/bundlephobia/min/gtag-ga) [![Followers](https://img.shields.io/github/followers/jooy2?style=social)](https://github.com/jooy2) ![Stars](https://img.shields.io/github/stars/jooy2/gtag-ga?style=social)\n\n- ⚡️ Lightweight modules \u0026 quick setup \u0026 fast performance\n- ⚡️ Zero dependency packages. ESM packages available everywhere\n- ⚡️ Support for the latest Node.js, Google Analytics 4\n- ⚡️ Support for TypeScript\n\n# Installation\n\n`gtag-ga` requires `Node.js 16.x` or higher, and the repository is serviced through **[NPM](https://npmjs.com)**.\n\nAfter configuring the node environment, you can simply run the following command.\n\n```bash\n# via npm\n$ npm install gtag-ga\n\n# via yarn\n$ yarn add gtag-ga\n\n# via pnpm\n$ pnpm install gtag-ga\n```\n\n# How to use\n\n```javascript\nimport { initializeGtag } from 'gtag-ga';\n\ninitializeGtag('G-XXXXXXXXXX'); // Your tracking code\n```\n\n# Methods\n\n### `initializeGtag (void)`\n\nEnable `gtag.js` in your webpage environment. Ideally, it should only be called once at the start (but multiple calls won't hurt). The first argument value should include your Google Analytics tracking ID, which starts with `G-`.\n\n- `(Required) trackingId::string`\n- `config::object`\n\n```javascript\ninitializeGtag('G-XXXXXXXXXX'); // Your tracking code\n```\n\n### `gtag (void)`\n\nThe usage of this function is the same as the gtag functions used in regular `gtag.js`.\n\nLearn more in the official `gtag.js` documentation at: https://developers.google.com/tag-platform/gtagjs/configure#step_2_send_data_with_event\n\n```javascript\ngtag('event', 'eventName', { 'key': 'value' });\n```\n\n## Contributing\n\nAnyone can contribute to the project by reporting new issues or submitting a pull request. For more information, please see [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## License\n\nPlease see the [LICENSE](LICENSE) file for more information about project owners, usage rights, and more.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjooy2%2Fgtag-ga","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjooy2%2Fgtag-ga","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjooy2%2Fgtag-ga/lists"}