{"id":31835005,"url":"https://github.com/inblossoms/tracker-sdk","last_synced_at":"2025-10-12T00:50:27.688Z","repository":{"id":198852733,"uuid":"701357527","full_name":"inblossoms/tracker-sdk","owner":"inblossoms","description":"A SDK data burying tool for the front end","archived":false,"fork":false,"pushed_at":"2023-12-16T15:11:45.000Z","size":40,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-12-16T16:29:17.680Z","etag":null,"topics":["sdk-javascript"],"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/inblossoms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-06T13:23:22.000Z","updated_at":"2023-10-10T12:56:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"7cbfd099-3221-4660-8295-9164275fa850","html_url":"https://github.com/inblossoms/tracker-sdk","commit_stats":null,"previous_names":["inblossoms/fe-tracker","inblossoms/tracker-sdk"],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/inblossoms/tracker-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inblossoms%2Ftracker-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inblossoms%2Ftracker-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inblossoms%2Ftracker-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inblossoms%2Ftracker-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inblossoms","download_url":"https://codeload.github.com/inblossoms/tracker-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inblossoms%2Ftracker-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279009504,"owners_count":26084609,"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-10-11T02:00:06.511Z","response_time":55,"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":["sdk-javascript"],"created_at":"2025-10-12T00:50:22.677Z","updated_at":"2025-10-12T00:50:27.680Z","avatar_url":"https://github.com/inblossoms.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tracker\n\nA SDK data burying tool for the front end, the specific implementation details can be viewed 'src/core/index.ts'.\n\nOf course, you can expand private needs on the basis of this library.\n\nBuried point monitoring is usually to provide some data to the product\n1. For example, how many messages have been sent to wechat\n2. Logs monitor the upstream interface and downstream output\nSo that the page error can locate the problem\n\nTherefore, data monitoring is indispensable in the development process.\n\n### Options introduction:\n\n```ts\n# configuring params\n/**\n * @uuid user Id\n * @requestUrl 数据上报地址\n * @historyTracker history上报\n * @hashTracker hash上报\n * @domTracker 事件上报（需携带 Tracker-key）\n * @sdkVersion sdk版本\n * @extra User DIY 透传字段\n * @jsError js 和 promise 报错异常上报\n */\nexport interface DefaultOptons {\n  uuid: string | undefined;\n  requestUrl: string | undefined;\n  historyTracker: boolean;\n  hashTracker: boolean;\n  domTracker: boolean;\n  jsError: boolean;\n  sdkVersion: string | number;\n  extra: Record\u003cstring, any\u003e | undefined;\n}\n\n\n# coustom report\nexport type reportTrackerData = {\n  [ErrType: string]: {\n    [key: string]: any;\n    event: string;\n    targetKey: string;\n  };\n};\n```\n\n### Usage:\n\n```js\nconst tr = new Tracker.Tracker({\n  requestUrl: \"http://localhost:3300/xxxx\", //接口地址\n  historyTracker: true,\n  domTracker: true,\n  jsError: true,\n});\n```\n\n### Feature:\n\n1.  Page Viewer: `historyTracker: true or hashTracker: true`\n2.  Dom tracker: `domTracker: true`\n3.  Js Error: `jsError: true`, following events are monitored internally:\n    1.  SyntaxError\n    2.  RangeError\n    3.  ReferenceError\n    4.  EvalError\n    5.  TypeError\n    6.  URIError\n    7.  Ajax(safeRange: 200 \u003c code \u003c 400) | \u003cFetch Error: not yet realized\u003e\n    8.  资源加载错误\n\n```js\n# Dom tracker: 通过在元素上添加 target-key 属性，这样表可以在上报时携带元素数据信息\n\u003cbutton target-key=\"埋点值\"\u003e按钮\u003c/button\u003e\nconst tr = new Tracker({\n  requestUrl: \"http://localhost:3000/xxxx\", //接口地址\n  domTracker: true,\n});\n\n\n# 用户唯一表示 可以在登录之后通过接口返回的 id 进行设置值 提供了 setUserId\n# 主要是给需要监听的元素添加一个属性 用来区分是否需要监听 target-key\ntr.setUserId();\n\n\n# Tracker 提供了自定义上报的能力，必须包含 event 和 targetKey  两个字段\ntr.sendTracker({\n\tevent: \"\",\n\ttargetKey: \"\",\n });\n\n# 同时，也存在一个可供用户进行数据携带的方法\ntr.setExtra\u003cT extends DefaultOptons[\"extra\"]\u003e()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finblossoms%2Ftracker-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finblossoms%2Ftracker-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finblossoms%2Ftracker-sdk/lists"}