{"id":41165095,"url":"https://github.com/pirsch-analytics/pirsch-js-sdk","last_synced_at":"2026-01-22T19:32:03.851Z","repository":{"id":38356977,"uuid":"350009018","full_name":"pirsch-analytics/pirsch-js-sdk","owner":"pirsch-analytics","description":"JavaScript Client SDK for Pirsch Analytics.","archived":false,"fork":false,"pushed_at":"2025-07-04T11:47:32.000Z","size":289,"stargazers_count":25,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-24T05:44:39.318Z","etag":null,"topics":["analytics","client","javascript","pirsch","sdk"],"latest_commit_sha":null,"homepage":"https://pirsch.io","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/pirsch-analytics.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-03-21T13:37:13.000Z","updated_at":"2025-09-11T02:21:53.000Z","dependencies_parsed_at":"2023-02-16T21:31:28.653Z","dependency_job_id":"5f66414b-de86-4656-86a3-1a5b00d027f3","html_url":"https://github.com/pirsch-analytics/pirsch-js-sdk","commit_stats":{"total_commits":129,"total_committers":6,"mean_commits":21.5,"dds":"0.33333333333333337","last_synced_commit":"3702a2df43d439145608eba7b39bfdd9496b33c2"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/pirsch-analytics/pirsch-js-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirsch-analytics%2Fpirsch-js-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirsch-analytics%2Fpirsch-js-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirsch-analytics%2Fpirsch-js-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirsch-analytics%2Fpirsch-js-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pirsch-analytics","download_url":"https://codeload.github.com/pirsch-analytics/pirsch-js-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirsch-analytics%2Fpirsch-js-sdk/sbom","scorecard":{"id":735366,"data":{"date":"2025-08-11","repo":{"name":"github.com/pirsch-analytics/pirsch-js-sdk","commit":"107764da73cc9c98621969eb86a716548a495b7b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Code-Review","score":1,"reason":"Found 4/26 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":2,"reason":"3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-xffm-g5w8-qvg7","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T15:37:55.771Z","repository_id":38356977,"created_at":"2025-08-22T15:37:55.772Z","updated_at":"2025-08-22T15:37:55.772Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28669146,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T17:07:18.858Z","status":"ssl_error","status_checked_at":"2026-01-22T17:05:02.040Z","response_time":144,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["analytics","client","javascript","pirsch","sdk"],"created_at":"2026-01-22T19:32:03.766Z","updated_at":"2026-01-22T19:32:03.838Z","avatar_url":"https://github.com/pirsch-analytics.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pirsch JavaScript SDK\n\n\u003ca href=\"https://www.npmjs.com/package/pirsch-sdk\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/pirsch-sdk.svg?sanitize=true\" alt=\"Version\"\u003e\u003c/a\u003e\n\nThis is the official JavaScript client SDK for Pirsch. For details, please check out our [documentation](https://docs.pirsch.io/).\n\n## Installation\n\n```\nnpm i pirsch-sdk\n```\n\n## Usage\n\n### Configuration\n\nThe SDK is configured using the constructor. We recommend using an access key instead of a client ID + secret if you only need write access (sending page views and events), as it saves a roundtrip to the server when refreshing the access token.\n\nIf you run your server-side integration behind a proxy or load balancer, make sure you correctly configure `trustedProxyHeaders`. They will be used to extract the real visitor IP for each request. They will be used in the order they are passed into the configuration. Possible values are: `\"cf-connecting-ip\", \"x-forwarded-for\", \"forwarded\", \"x-real-ip\"`.\n\n### Server-Side\n\nHere is a quick demo on how to use this library in NodeJS:\n\n```js\nimport { createServer } from \"node:http\";\nimport { URL } from \"node:url\";\n\n// Import the Pirsch client.\nimport { Pirsch } from \"pirsch-sdk\";\n\n// Create a client with the hostname, client ID, and client secret you have configured on the Pirsch dashboard.\nconst client = new Pirsch({\n    hostname: \"example.com\",\n    protocol: \"http\", // used to parse the request URL, default is https\n    clientId: \"\u003cclient_id\u003e\",\n    clientSecret: \"\u003cclient_secret or access_key\u003e\"\n});\n\n// Create your http handler and start the server.\ncreateServer((request, response) =\u003e {\n    // In this example, we only want to track the / path and nothing else.\n    // We parse the request URL to read and check the pathname.\n    const url = new URL(request.url || \"\", \"http://localhost:8765\");\n\n    if (url.pathname === \"/\") {\n        // Send the hit to Pirsch. hitFromRequest is a helper function that returns all required information from the request.\n        // You can also built the Hit object on your own and pass it in.\n        client.hit(client.hitFromRequest(request)).catch(error =\u003e {\n            // Something went wrong, check the error output.\n            console.error(error);\n        });\n    }\n\n    // Render your website...\n    response.write(\"Hello from Pirsch!\");\n    response.end();\n}).listen(8765);\n```\n\n### Client-Side\n\nHere is how you can do the same in the browser:\n\n```js\n// Import the Pirsch client.\nimport { Pirsch } from \"pirsch-sdk/web\";\n\n// Create a client with the identification code you have configured on the Pirsch dashboard.\nconst client = new Pirsch({\n    identificationCode: \"\u003cidentification_code\u003e\"\n});\n\nconst main = async () =\u003e {\n    await client.hit();\n\n    await client.event(\"test-event\", 60, { clicks: 1, test: \"xyz\" });\n}\n\nvoid main();\n```\n\n## FAQ\n\n\u003e This module export three Clients (`pirsch-sdk`, `pirsch-sdk/web-api` and `pirsch-sdk/web`), what are the differences?\n\n - `pirsch-sdk` and `pirsch-sdk/web-api` are based on the same core logic, and function the same. It can be used to access and sending data via the API. `pirsch-sdk/web-api` is a version of the Node client that works in the web. You will rarely need to use this version though.\n - `pirsch-sdk/web` is a modular version of the JS Snippet, that has no automatic functionality. You need to send any hits or events yourself.\n\n\u003e :information_source: Basically your choice will be between `pirsch-sdk` (Node, backend, accessing or sending data) or `pirsch-sdk/web`, (Browser, frontend, sending data) in 99% of the cases.\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirsch-analytics%2Fpirsch-js-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpirsch-analytics%2Fpirsch-js-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirsch-analytics%2Fpirsch-js-sdk/lists"}