{"id":50977474,"url":"https://github.com/thebarty/analytics-js-without-segment","last_synced_at":"2026-06-19T09:32:55.917Z","repository":{"id":57177641,"uuid":"154686488","full_name":"thebarty/analytics-js-without-segment","owner":"thebarty","description":"A toolset to use Segments open-source analytics library (analytics.js) WITHOUT using the paid Segment service (segment.com). To be used with your favorite analytics-tools like Google Analytics, Mixpanel, Hotjar, etc.","archived":false,"fork":false,"pushed_at":"2019-06-04T07:10:50.000Z","size":7,"stargazers_count":48,"open_issues_count":4,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-03T23:39:47.413Z","etag":null,"topics":["analytics","analyticsjs","free","google-analytics","hotjar","mixpanel","segment","standalone","without"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/thebarty.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":"2018-10-25T14:35:07.000Z","updated_at":"2024-01-29T16:14:11.000Z","dependencies_parsed_at":"2022-09-14T02:00:58.588Z","dependency_job_id":null,"html_url":"https://github.com/thebarty/analytics-js-without-segment","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thebarty/analytics-js-without-segment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebarty%2Fanalytics-js-without-segment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebarty%2Fanalytics-js-without-segment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebarty%2Fanalytics-js-without-segment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebarty%2Fanalytics-js-without-segment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thebarty","download_url":"https://codeload.github.com/thebarty/analytics-js-without-segment/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebarty%2Fanalytics-js-without-segment/sbom","scorecard":{"id":877929,"data":{"date":"2025-08-11","repo":{"name":"github.com/thebarty/analytics-js-without-segment","commit":"a0366bb36b0fcb531a2de786ded01ecfd22ba799"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":"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":"Code-Review","score":3,"reason":"Found 1/3 approved changesets -- score normalized to 3","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":"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"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 2 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"}}]},"last_synced_at":"2025-08-24T06:47:32.450Z","repository_id":57177641,"created_at":"2025-08-24T06:47:32.450Z","updated_at":"2025-08-24T06:47:32.450Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34526066,"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-19T02:00:06.005Z","response_time":61,"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":["analytics","analyticsjs","free","google-analytics","hotjar","mixpanel","segment","standalone","without"],"created_at":"2026-06-19T09:32:55.745Z","updated_at":"2026-06-19T09:32:55.906Z","avatar_url":"https://github.com/thebarty.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Use analytics.js without Segment (analytics-js-without-segment)\n\nA tool to use (and render) Segments open-source analytics library (analytics.js) **WITHOUT using the paid Segment service** (segment.com). To be used with your favorite analytics-tools like **Google Analytics, Mixpanel, Hotjar, etc.**\n\n@Gatsby-users: Use the [related gatsby-package](https://github.com/thebarty/gatsby-plugin-analytics-without-segment).\n\n## Features\n\n * **Best-practise loading of analytics.js**: This plugin loads [Segments analytics.js](https://github.com/segmentio/analytics.js) following [best-practises](http://www.ianww.com/blog/2017/08/06/analytics-js-standalone-library/) and enables you to easily set options (`cdnUrl` and `services`).\n * **Unlimited and free**: You'll use the free analytics.js and not depend on Segment (which has aggressive pay-or-leave policies, after you hit the 1000 free monthly users)\n * **Track events anywhere**: You can track custom-events anywhere in your code via `analytics.track()`\n * **Supported integrations**: A LOT of analytics-tools are supported. see https://github.com/segment-integrations.\n * **Development-mode**: In development you'll only see the events in the console. Your events will NOT be forwarded\n * **Production-mode**: All events will be routed to the services. Check your console for possible errors.\n\n## INSTALL\n\nInstall via npm\n\n```\nnpm install analytics-js-without-segment --save\n```\n\n## Usage\n\nIn your client, add:\n\n```\nconst { renderAnalytics, runAnalytics } = require('analytics-js-without-segment')\n\nconst options = {\n  cdnUrl: 'https://cdnjs.cloudflare.com/ajax/libs/analytics.js/2.9.1/analytics.min.js',  // host yourself or use cdnjs (https://cdnjs.com/libraries/analytics.js)\n  services: {\n    // see integration https://github.com/segment-integrations/analytics.js-integration-google-analytics/blob/master/lib/index.js\n    'Google Analytics': {\n      trackingId: 'UA-XXX-1',\n      anonymizeIp: true,\n    },\n    // see integration https://github.com/segment-integrations/analytics.js-integration-mixpanel/blob/master/lib/index.js\n    'Mixpanel': {\n      token: 'XXX',\n      people: true,\n      trackAllPages: true,\n    },\n    // see integration https://github.com/segment-integrations/analytics.js-integration-fullstory/blob/master/lib/index.js\n    'FullStory': {\n      org: 'XXX',\n      debug: true,\n    },\n    // ... other service? See supported integrations (that can be loaded via analytics.js) at https://github.com/segment-integrations.\n  },\n}\n\n// OPTION 1)\n// AUTOMATICALLY attach to window.analytics and make global `analytics.*`-object available\nrunAnalytics(options)  // after running this, `analytics` is globally available\n\n// OPTION 2)\n// MANUALLY attach to window.analytics and make global `analytics.*`-object available\nconst snippet = renderAnalytics(options)\neval(snippet)\n```\n\n## Why this package?\nThe concept of analytics.js is awesome. **BUT Segments's  free tier (max 1.000 monthly users) might not work for you**, if you have a lot of non-paying visitors on your website.\n\nSo if you want an **easy-to-configure** `analytics.js`-wrapper for your analytics (**Google Analytics, Mixpanel, Hotjar, YouNameIt, ...**), then this is your go-to! Basically **ALL big analytics-integrations are supported**.\n\n**This solution is open source, unlimited and free forever!**\n\n*Background (state 2018-10-24): Segment.com has aggressive pay-or-leave policies, which they will apply after you hit the 1000 free monthly users limit. They will lock your account and stop processing your events after a deadline.*\n\n## WHY using this?\n\nAdvantages:\n * You will NOT run out of segments free tier after hitting 1000 MPU (monthly users), because you simply do NOT use it\n * You'll have a single API for tracking analytics (p.e. `analytics.page()` or `analytics.track()`)\n\nDisadvantages:\n * This does NOT work on server-side\n * It might take a bit more time to configure than using segment\n * You do NOT any of segments other cool features (which you will not need when starting a side-project)\n\n## Question: What analytics-services are supported?\nYou should be able to use ALL services that segment itself supports and has integrations available. You'll have to dig around a bit in segment's code to find the options for each individual tool.\n\nCheck out the supported Integrations (that can be loaded via analytics.js) at https://github.com/segment-integrations.\n\n## Credits\n\nThis is project is based on https://gist.github.com/typpo/5e2e4403c60314e04e8b6b257555f6de\n and the related blogpost at http://www.ianww.com/blog/2017/08/06/analytics-js-standalone-library/.\n\n## Contribute (Development notes)\n\nCLI cheatsheat:\n\n```\nnpm run build-watch;  # auto-compile on file-change from /src to / via babel\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebarty%2Fanalytics-js-without-segment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthebarty%2Fanalytics-js-without-segment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebarty%2Fanalytics-js-without-segment/lists"}