{"id":19806655,"url":"https://github.com/timnew/sa-sdk-js","last_synced_at":"2026-06-16T09:31:47.338Z","repository":{"id":145702594,"uuid":"59465077","full_name":"timnew/sa-sdk-js","owner":"timnew","description":null,"archived":false,"fork":false,"pushed_at":"2016-05-23T12:41:57.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T18:00:51.731Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/timnew.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-23T08:22:40.000Z","updated_at":"2016-05-23T08:22:57.000Z","dependencies_parsed_at":"2023-04-07T23:48:04.100Z","dependency_job_id":null,"html_url":"https://github.com/timnew/sa-sdk-js","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"07cdda8ca4494510b7ccc1929da6784218179737"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/timnew/sa-sdk-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2Fsa-sdk-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2Fsa-sdk-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2Fsa-sdk-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2Fsa-sdk-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timnew","download_url":"https://codeload.github.com/timnew/sa-sdk-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2Fsa-sdk-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34400451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"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":[],"created_at":"2024-11-12T09:08:07.677Z","updated_at":"2026-06-16T09:31:47.319Z","avatar_url":"https://github.com/timnew.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Sensors Analytics  [![NPM version][npm-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Dependency Status][depstat-image]][depstat-url]\n==============================\n\n\u003e This is yet another JavaScript SDK for [Sensors Analytics].\n\n## Why Another SDK\n\nWell, there are a bunch of issues with current official SDK, here are a brief list:\n\n* Official JS SDK released as single file, instead of NPM package\n* Official JS SDK doesn't support CommonJS/AMD/UMD, instead it injects global instance\n* Official JS SDK is not friendly to Browserify/Webpack/Rollup\n* Official JS SDK is not friendly to isomorphic web app\n\nFrom source level, the code has following issues:\n\n* Official JS SDK hasn't be open-sourced yet. The version on Github doesn't work.\n* Official JS SDK contains a bunch of not used code.\n* Official JS SDK is built with private patched version of NPM packages.\n\nTo resolve these issues, and make it more up to the fashion, I wrote this library.\nThe structure and implementation heavily depends on [sa-sdk-node]. But simplified for front-end need.\n\n## Install\n\nInstall using [npm][npm-url].\n\n    $ npm install sa-sdk-js --save\n\n## Usage\n\n### Basic Usage\n\n```js\nimport SensorsAnalytics from 'sa-sdk-js'\n\nconst sa = new SensorsAnalytics()\n\nsa.submitTo('http://xxx.cloud.sensorsdata.cn:8006/sa?token=xxx')\n\nsa.identify('userid')\n\n// Super Properties that assigned to every event tracking\nsa.registerSuperProperties({ $appVersion: '1.0.0', env: 'production' })\n\n// Track event\nsa.track('userHappy')\n\n// Track event with custom properties\nsa.track('newOrder', { orderId: '12323' })\n\n// Track event with specific time\nsa.track(\"newOrder\", { orderId: '123234', '$time': new Date('2016-03-12T05:24:19.894+08:00') })\n\n// Track Signup\nsa.trackSignup('anonymous-id/device-id')\n\n// Manipuate user project\nsa.profileSet({ age: 18 })\nsa.profileSetOnce({ registerTime: new Date().valueOf() })\nsa.profileIncrement({ scoreCount: 100, issueCount: -1 })\nsa.profileAppend({ tags: ['student', 'developer'] })\nsa.profileUnset(['temporaryTag'])\n```\n\nFor more detailed information about each api, checkout [Sensors Analytics manual]\n\n## License\nMIT\n\n[![NPM downloads][npm-downloads]][npm-url]\n\n[homepage]: https://github.com/timnew/sa-sdk-js\n\n[npm-url]: https://npmjs.org/package/sa-sdk-js\n[npm-image]: http://img.shields.io/npm/v/sa-sdk-js.svg?style=flat\n[npm-downloads]: http://img.shields.io/npm/dm/sa-sdk-js.svg?style=flat\n\n[ci-url]: https://travis-ci.org/timnew/sa-sdk-js/\n[ci-image]: https://img.shields.io/travis/timnew/sa-sdk-js.svg?style=flat\n\n[depstat-url]: https://gemnasium.com/timnew/sa-sdk-js\n[depstat-image]: http://img.shields.io/gemnasium/timnew/sa-sdk-js.svg?style=flat\n\n[sa-sdk-node]: https://github.com/timnew/sa-sdk-node\n\n[Sensors Analytics]: http://sensorsdata.cn/\n[Sensors Analytics manual]: http://sensorsdata.cn/manual/index.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimnew%2Fsa-sdk-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimnew%2Fsa-sdk-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimnew%2Fsa-sdk-js/lists"}