{"id":15171708,"url":"https://github.com/mntm-lib/stats","last_synced_at":"2025-10-25T21:32:24.676Z","repository":{"id":65366217,"uuid":"417314875","full_name":"mntm-lib/stats","owner":"mntm-lib","description":"A package for integrating analytics tools.","archived":false,"fork":false,"pushed_at":"2023-01-19T16:50:39.000Z","size":48,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T10:51:14.743Z","etag":null,"topics":["amplitude","analytics","facebook","fb","google-tag-manager","gtm","pixel","statistics","stats","vk","vkcom","vkontakte"],"latest_commit_sha":null,"homepage":"https://npm.im/@mntm/stats","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mntm-lib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-14T23:51:28.000Z","updated_at":"2025-01-12T06:14:58.000Z","dependencies_parsed_at":"2023-02-11T10:40:22.972Z","dependency_job_id":null,"html_url":"https://github.com/mntm-lib/stats","commit_stats":null,"previous_names":["maxi-team/stats"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mntm-lib%2Fstats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mntm-lib%2Fstats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mntm-lib%2Fstats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mntm-lib%2Fstats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mntm-lib","download_url":"https://codeload.github.com/mntm-lib/stats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238212454,"owners_count":19434955,"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":["amplitude","analytics","facebook","fb","google-tag-manager","gtm","pixel","statistics","stats","vk","vkcom","vkontakte"],"created_at":"2024-09-27T09:02:32.292Z","updated_at":"2025-10-25T21:32:19.387Z","avatar_url":"https://github.com/mntm-lib.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @mntm/stats [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/maxi-team/stats/blob/master/LICENSE) [![npm bundle size](https://img.shields.io/bundlephobia/min/@mntm/stats)](https://bundlephobia.com/result?p=@mntm/stats)\n\n\u003e Inspired by [vk-stat](https://github.com/denismart/vk-stat)\n\nA package for integrating analytics tools.\n\n## Implemented providers\n\n- [VK Statistics](https://vk.com/dev/statEvents.addMiniApps)\n- [Google Tag Manager](https://tagmanager.google.com)\n- [Amplitude](https://amplitude.com)\n- [Yandex Metrika](https://metrika.yandex.ru)\n- [Google Analytics](https://analytics.google.com)\n- [Universal Analytics](https://analytics.google.com)\n\n## Implemented pixels\n\n- [VK Pixel](https://vk.com/faq12142)\n- [Facebook Pixel](https://www.facebook.com/business/learn/facebook-ads-pixel)\n\n## Prepare\n\n### [GTM] Google Tag Manager\n\nWhen using Universal Analytics with GTM, need set `storage:none`. Without these settings will not work GA, when you install GTM in iframe.\n\n### [VK] VK Statistics\n\nYou need request permissions for `statEvents.addMiniApps` in [miniapps](http://vk.link/miniapps) with `mini_app_id`.\n\n## Installation\n\nWe recommend to use [yarn](https://classic.yarnpkg.com/en/docs/install/) for dependency management:\n\n```shell\nyarn add @mntm/stats\n```\n\n## Event params\n\n```typescript\n{\n  // [GTM|GA|UA|VK] event category\n  category: string;\n\n  // [GTM|GA|UA] event label\n  label: string;\n\n  // [VK|GA|UA|YM] screen where event occurred\n  screen: string;\n\n  // [VK|AMP] additional parameters\n  params: Record\u003cstring, unknown\u003e;\n}\n```\n\n## Usage\n\n```typescript\nimport {\n  prepareParams,\n  createProviderGTM,\n  createSend\n} from '@mntm/stats';\n\n// Re-assigns all query params, for example, for UTM tags.\nprepareParams();\n\n// Create send function\nconst sendStats = createSend([\n  createProviderGTM('GTM-XXXXXXX')\n]);\n\n// Send event to all providers\nsendStats('launch', {\n  label: 'web_app'\n});\n```\n\n## VK API implementation\n\nNeed for VK Statistics provider:\n\n```typescript\n// See @mntm/painless-bridge for enhanced bridge implementation\nimport bridge from '@vkontakte/vk-bridge';\n\n// Early token initialization\nconst token = bridge.send('VKWebAppGetAuthToken', {\n  // Your app_id\n  app_id: 7415273,\n  scope: ''\n});\n\n// Example of reuseable implementation\nconst api = async (method: string, params: Record\u003cstring, unknown\u003e) =\u003e {\n  const { access_token } = await token;\n\n  const result = await bridge.send('VKWebAppCallAPIMethod', {\n    method,\n    params: Object.assign({\n      access_token,\n      v: '5.160'\n    }, params);\n  });\n\n  return result;\n};\n```\n\n## Contributing\n\nDevelopment of @mntm/stats happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements.\n\n## License\n\n@mntm/stats is [MIT licensed](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmntm-lib%2Fstats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmntm-lib%2Fstats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmntm-lib%2Fstats/lists"}