{"id":13631740,"url":"https://github.com/segmentio/analytics-ruby","last_synced_at":"2025-10-23T07:57:20.313Z","repository":{"id":6329375,"uuid":"7564790","full_name":"segmentio/analytics-ruby","owner":"segmentio","description":"The hassle-free way to integrate analytics into any Ruby application.","archived":false,"fork":false,"pushed_at":"2024-10-07T23:06:15.000Z","size":445,"stargazers_count":383,"open_issues_count":2,"forks_count":124,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-10-16T16:39:42.394Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://segment.com/libraries/ruby","language":"Ruby","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/segmentio.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":null,"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":"2013-01-11T18:33:55.000Z","updated_at":"2025-10-16T16:13:30.000Z","dependencies_parsed_at":"2023-02-13T20:01:11.197Z","dependency_job_id":"7481add6-b91a-4f7c-9c06-0acb6d0616ef","html_url":"https://github.com/segmentio/analytics-ruby","commit_stats":{"total_commits":364,"total_committers":52,"mean_commits":7.0,"dds":0.7692307692307692,"last_synced_commit":"46cec0cc3a9cb5f67c606414d73d02e7fc690e1b"},"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"purl":"pkg:github/segmentio/analytics-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segmentio%2Fanalytics-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segmentio%2Fanalytics-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segmentio%2Fanalytics-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segmentio%2Fanalytics-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/segmentio","download_url":"https://codeload.github.com/segmentio/analytics-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segmentio%2Fanalytics-ruby/sbom","scorecard":{"id":809860,"data":{"date":"2025-08-11","repo":{"name":"github.com/segmentio/analytics-ruby","commit":"167f59fb0333c3a18df86923f198cf136376a3d1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.6,"checks":[{"name":"Code-Review","score":8,"reason":"Found 5/6 approved changesets -- score normalized to 8","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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/gem-push.yml:11","Warn: no topLevel permission defined: .github/workflows/create_jira.yml:1","Warn: no topLevel permission defined: .github/workflows/gem-push.yml:1","Warn: no topLevel permission defined: .github/workflows/ruby.yml:1","Info: no jobLevel write permissions found"],"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":10,"reason":"no dangerous workflow patterns detected","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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/create_jira.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/segmentio/analytics-ruby/create_jira.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/create_jira.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/segmentio/analytics-ruby/create_jira.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/create_jira.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/segmentio/analytics-ruby/create_jira.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/gem-push.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/segmentio/analytics-ruby/gem-push.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/gem-push.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/segmentio/analytics-ruby/gem-push.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ruby.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/segmentio/analytics-ruby/ruby.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ruby.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/segmentio/analytics-ruby/ruby.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ruby.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/segmentio/analytics-ruby/ruby.yml/master?enable=pin","Warn: downloadThenRun not pinned by hash: .buildscript/e2e.sh:11","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned"],"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":"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":"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":"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":"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":"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":"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":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/gem-push.yml:7"],"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":"Branch-Protection","score":4,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Warn: 'branch protection settings apply to administrators' is disabled on branch 'master'","Info: 'stale review dismissal' is required to merge on branch 'master'","Warn: required approving review count is 1 on branch 'master'","Warn: codeowners review is required - but no codeowners file found in repo","Warn: 'last push approval' is disabled on branch 'master'","Warn: 'up-to-date branches' is disabled on branch 'master'","Info: status check found to merge onto on branch 'master'","Info: PRs are required in order to make changes on 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 29 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-23T12:49:27.714Z","repository_id":6329375,"created_at":"2025-08-23T12:49:27.714Z","updated_at":"2025-08-23T12:49:27.714Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280583893,"owners_count":26355258,"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-23T02:00:06.710Z","response_time":142,"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-08-01T22:02:36.429Z","updated_at":"2025-10-23T07:57:20.281Z","avatar_url":"https://github.com/segmentio.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"analytics-ruby\n==============\n\nanalytics-ruby is a ruby client for [Segment](https://segment.com)\n\n### ⚠️ Maintenance ⚠️\nThis library is in maintenance mode. It will send data as intended, but receive no new feature support and only critical maintenance updates from Segment.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/16131737/53616965-fcdeb680-3b99-11e9-934c-53917ac1e563.png\"/\u003e\n  \u003cp\u003e\u003cb\u003e\u003ci\u003eYou can't fix what you can't measure\u003c/i\u003e\u003c/b\u003e\u003c/p\u003e\n\u003c/div\u003e\n\nAnalytics helps you measure your users, product, and business. It unlocks insights into your app's funnel, core business metrics, and whether you have product-market fit.\n\n## How to get started\n1. **Collect analytics data** from your app(s).\n    - The top 200 Segment companies collect data from 5+ source types (web, mobile, server, CRM, etc.).\n2. **Send the data to analytics tools** (for example, Google Analytics, Amplitude, Mixpanel).\n    - Over 250+ Segment companies send data to eight categories of destinations such as analytics tools, warehouses, email marketing and remarketing systems, session recording, and more.\n3. **Explore your data** by creating metrics (for example, new signups, retention cohorts, and revenue generation).\n    - The best Segment companies use retention cohorts to measure product market fit. Netflix has 70% paid retention after 12 months, 30% after 7 years.\n\n[Segment](https://segment.com) collects analytics data and allows you to send it to more than 250 apps (such as Google Analytics, Mixpanel, Optimizely, Facebook Ads, Slack, Sentry) just by flipping a switch. You only need one Segment code snippet, and you can turn integrations on and off at will, with no additional code. [Sign up with Segment today](https://app.segment.com/signup).\n\n### Why?\n1. **Power all your analytics apps with the same data**. Instead of writing code to integrate all of your tools individually, send data to Segment, once.\n\n2. **Install tracking for the last time**. We're the last integration you'll ever need to write. You only need to instrument Segment once. Reduce all of your tracking code and advertising tags into a single set of API calls.\n\n3. **Send data from anywhere**. Send Segment data from any device, and we'll transform and send it on to any tool.\n\n4. **Query your data in SQL**. Slice, dice, and analyze your data in detail with Segment SQL. We'll transform and load your customer behavioral data directly from your apps into Amazon Redshift, Google BigQuery, or Postgres. Save weeks of engineering time by not having to invent your own data warehouse and ETL pipeline.\n\n    For example, you can capture data on any app:\n    ```js\n    analytics.track('Order Completed', { price: 99.84 })\n    ```\n    Then, query the resulting data in SQL:\n    ```sql\n    select * from app.order_completed\n    order by price desc\n    ```\n\n### 🚀 Startup Program\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://segment.com/startups\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/16131737/53128952-08d3d400-351b-11e9-9730-7da35adda781.png\" /\u003e\u003c/a\u003e\n\u003c/div\u003e\nIf you are part of a new startup  (\u0026lt;$5M raised, \u0026lt;2 years since founding), we just launched a new startup program for you. You can get a Segment Team plan  (up to \u003cb\u003e$25,000 value\u003c/b\u003e in Segment credits) for free up to 2 years — \u003ca href=\"https://segment.com/startups/\"\u003eapply here\u003c/a\u003e!\n\n## Install\n\nInto Gemfile from rubygems.org:\n```ruby\ngem 'analytics-ruby'\n```\n\nInto environment gems from rubygems.org:\n```\ngem install 'analytics-ruby'\n```\n\n## Usage\n\nCreate an instance of the Analytics object:\n```ruby\nanalytics = Segment::Analytics.new(write_key: 'YOUR_WRITE_KEY')\n```\n\nIdentify the user for the people section, see more [here](https://segment.com/docs/libraries/ruby/#identify).\n```ruby\nanalytics.identify(user_id: 42,\n                   traits: {\n                     email: 'name@example.com',\n                     first_name: 'Foo',\n                     last_name: 'Bar'\n                   })\n```\n\nAlias an user, see more [here](https://segment.com/docs/libraries/ruby/#alias).\n```ruby\nanalytics.alias(user_id: 41)\n```\n\nTrack a user event, see more [here](https://segment.com/docs/libraries/ruby/#track).\n```ruby\nanalytics.track(user_id: 42, event: 'Created Account')\n```\n\nThere are a few calls available, please check the documentation section.\n\n## Documentation\n\nDocumentation is available at [segment.com/docs/sources/server/ruby](https://segment.com/docs/sources/server/ruby/)\n\n### Test Queue\n\nYou can use the `test: true` option to Segment::Analytics.new to cause all requests to be saved to a test queue until manually reset. All events will process as specified by the configuration, and they will also be stored in a separate queue for inspection during testing.\n\nA test queue can be used as follows:\n\n```ruby\nclient = Segment::Analytics.new(write_key: 'YOUR_WRITE_KEY', test: true)\n\nclient.test_queue # =\u003e #\u003cSegment::Analytics::TestQueue:0x00007f88d454e9a8 @messages={}\u003e\n\nclient.track(user_id: 'foo', event: 'bar')\n\nclient.test_queue.all\n# [\n#     {\n#            :context =\u003e {\n#             :library =\u003e {\n#                    :name =\u003e \"analytics-ruby\",\n#                 :version =\u003e \"2.2.8.pre\"\n#             }\n#         },\n#          :messageId =\u003e \"e9754cc0-1c5e-47e4-832a-203589d279e4\",\n#          :timestamp =\u003e \"2021-02-19T13:32:39.547+01:00\",\n#             :userId =\u003e \"foo\",\n#               :type =\u003e \"track\",\n#              :event =\u003e \"bar\",\n#         :properties =\u003e {}\n#     }\n# ]\n\nclient.test_queue.track\n# [\n#     {\n#            :context =\u003e {\n#             :library =\u003e {\n#                    :name =\u003e \"analytics-ruby\",\n#                 :version =\u003e \"2.2.8.pre\"\n#             }\n#         },\n#          :messageId =\u003e \"e9754cc0-1c5e-47e4-832a-203589d279e4\",\n#          :timestamp =\u003e \"2021-02-19T13:32:39.547+01:00\",\n#             :userId =\u003e \"foo\",\n#               :type =\u003e \"track\",\n#              :event =\u003e \"bar\",\n#         :properties =\u003e {}\n#     }\n# ]\n\n# Other available methods\nclient.test_queue.alias # =\u003e []\nclient.test_queue.group # =\u003e []\nclient.test_queue.identify # =\u003e []\nclient.test_queue.page # =\u003e []\nclient.test_queue.screen # =\u003e []\n\nclient.test_queue.reset!\n\nclient.test_queue.all # =\u003e []\n```\n\nNote: It is recommended to call `reset!` before each test to ensure your test queue is empty. For example, in rspec you may have the following:\n\n```ruby\nRSpec.configure do |config|\n  config.before do\n    Analytics.test_queue.reset!\n  end\nend\n```\n\nAnd also to stub actions use `stub: true` along with `test: true` so that it doesn't send any real calls during specs.\n## License\n\n```\nWWWWWW||WWWWWW\n W W W||W W W\n      ||\n    ( OO )__________\n     /  |           \\\n    /o o|    MIT     \\\n    \\___/||_||__||_|| *\n         || ||  || ||\n        _||_|| _||_||\n       (__|__|(__|__|\n```\n\n(The MIT License)\n\nCopyright (c) 2013 Segment Inc. \u003cfriends@segment.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegmentio%2Fanalytics-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsegmentio%2Fanalytics-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegmentio%2Fanalytics-ruby/lists"}