{"id":19884647,"url":"https://github.com/danni-cool/node-gtag4","last_synced_at":"2025-05-02T15:31:14.023Z","repository":{"id":163546039,"uuid":"639021903","full_name":"danni-cool/node-gtag4","owner":"danni-cool","description":"A lightweight, browser api free, Node.js version of the Google Analytics SDK, the data reporting is accepted by Google Analytics 4.","archived":false,"fork":false,"pushed_at":"2024-05-06T14:10:07.000Z","size":224,"stargazers_count":6,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-13T03:19:37.390Z","etag":null,"topics":["data-report","ga4","google-analytics-4","gtag","node-analysis"],"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/danni-cool.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"polar":null,"custom":["https://danni.cool/Sponsor"]}},"created_at":"2023-05-10T15:34:45.000Z","updated_at":"2024-08-12T06:54:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"3b8339b2-3dd9-43eb-82cf-e52ad2a87bd8","html_url":"https://github.com/danni-cool/node-gtag4","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danni-cool%2Fnode-gtag4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danni-cool%2Fnode-gtag4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danni-cool%2Fnode-gtag4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danni-cool%2Fnode-gtag4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danni-cool","download_url":"https://codeload.github.com/danni-cool/node-gtag4/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224318086,"owners_count":17291594,"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":["data-report","ga4","google-analytics-4","gtag","node-analysis"],"created_at":"2024-11-12T17:28:35.265Z","updated_at":"2025-05-02T15:31:14.014Z","avatar_url":"https://github.com/danni-cool.png","language":"TypeScript","funding_links":["https://danni.cool/Sponsor"],"categories":[],"sub_categories":[],"readme":"# node-gtag4\n\n A lightweight, browser api-free and Node.js version of the Google Analytics SDK, the data reporting is accepted by Google Analytics 4.\n The primary purpose of this SDK is to assist early-stage tool projects in collecting usage data and improving their products at a lower cost.\n\n![](https://cdn.jsdelivr.net/gh/danni-cool/danni-cool@cdn/image/logo-nodeGtag.png)\n\n ![](https://img.shields.io/github/actions/workflow/status/danni-cool/node-gtag4/release.yml) ![](https://img.shields.io/npm/v/node-gtag4) ![](https://img.shields.io/npm/dw/node-gtag4)\n\nnode-gtag4 是一个功能精简，不依赖浏览器 API 的 Node 版本 Google Analytics SDK，数据可以上报 [Google Analytics 4](https://analytics.google.com/analytics/web/) 到并呈现在管理后台，此SDK初衷主要是为了帮助一些早期的工具项目以较低的成本收集使用数据并且改进自己的产品。\n\n# Install\n\n```bash\nnpm i node-gtag4\n```\n\n# Usage\n\n```bash\nconst ga = require('node-gtag4')('G-xxxxxx')\n\n// report pv\nga.pv('appFunction1')\n\n// report event\nga.event({category: 'myCategory', action: 'customAction', label:'label', value: 1})\n\n```\n\n# Data Results\n\n\u003e - ⚠️ notice: ga4's report view is a delayed data which appeared after 24 hours, realtime view's data appeared in about 30s and stayed for 30 mins. (from my test)\n\u003e - ⚠️ 注意：ga4 的报告视图是有24小时延迟计算的数据，这意味着上报后，这块数据不会立即呈现,实时视图的数据在30s内会能看到结果，但是只保留30分钟。（经过我的测试）\n\ndata type | screenshot |\n--- | --- |\ndata view (报告视图) | ![](https://cdn.jsdelivr.net/gh/danni-cool/danni-cool@cdn/image/ga-effect-screenshot.png) | \nrealtime view (实时视图) | ![](https://cdn.jsdelivr.net/gh/danni-cool/danni-cool@cdn/image/ga-realtime-screenshot.png) | \n\n# Plan\n\n[Details at issue](https://github.com/danni-cool/node-gtag4/issues/1)\n\n\n# License\n\nMIT\n\n\n\n# Changelog\n\n\n## 0.1.4 (2024-05-06)\n\n\n\n## 0.1.3 (2024-02-28)\n\n\n\n## 0.1.2 (2023-05-12)\n\n### Bug Fixes\n\n* 🐛 fix github action name conflict ([6a3f662](https://github.com/danni-cool/node-gtag/commit/6a3f662141ac4e875b05c24dca6f8acd98863405))\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanni-cool%2Fnode-gtag4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanni-cool%2Fnode-gtag4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanni-cool%2Fnode-gtag4/lists"}