{"id":19124140,"url":"https://github.com/efforg/eff_matomo","last_synced_at":"2026-06-15T06:34:31.977Z","repository":{"id":66385898,"uuid":"154229642","full_name":"EFForg/eff_matomo","owner":"EFForg","description":"Matomo API in Ruby","archived":false,"fork":false,"pushed_at":"2019-06-04T22:42:26.000Z","size":36,"stargazers_count":1,"open_issues_count":6,"forks_count":0,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-01-03T09:17:57.518Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/EFForg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2018-10-22T23:14:20.000Z","updated_at":"2020-02-28T16:10:56.000Z","dependencies_parsed_at":"2023-05-29T00:00:18.282Z","dependency_job_id":null,"html_url":"https://github.com/EFForg/eff_matomo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFForg%2Feff_matomo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFForg%2Feff_matomo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFForg%2Feff_matomo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFForg%2Feff_matomo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EFForg","download_url":"https://codeload.github.com/EFForg/eff_matomo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240183761,"owners_count":19761439,"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","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-09T05:28:15.313Z","updated_at":"2026-06-05T20:30:15.626Z","avatar_url":"https://github.com/EFForg.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EFF Matomo\n\nThe EFF Matomo gem provides utilities for integrating our Ruby applications with our analytics tool, Matomo.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'eff_matomo', require 'matomo'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install eff_matomo\n\n## Usage\n\n### Configuration\n\nThis gem reads two environment variables:\n* `MATOMO_SITE_ID`: The ID in Matomo of the app being tracked. **Required**.\n* `MATOMO_BASE_URL`: The URL where Matomo is being hosted. Defaults to \"https://anon-stats.eff.org\".\n\n### Adding the Matomo tracking embed to a Rails app\n\nAdd `\u003c%= matomo_tracking_embed %\u003e` to the footer of your application layout template.\n\n`{action_name = [NAME]}` can be passed to set the action name manually. Otherwise, eff_matomo will attempt to use a `page_title` helper or else omit the action name.\n\n### Displaying Matomo data\n\nThis gem provides allows users to import site usage data from Matomo to display in their application. It currently supports two types of data:\n\n**Referrers** show how users are reaching the application. Usage example:\n```ruby\n# Get the top five referrers for the site\nreferrers = Matomo::Referrer.top\n\n# Scope referrers by date range\nreferrers = Matomo::Referrer.where(start_date: Time.now - 1.month, end_date: Time.now)\n\n# Only show referrers for a certain page within the app\nreferrers = Matomo::Referrer.where(path: \"/action/my-important-action\")\n\n# Access information about each referrer\nreferrers.each() do |referrer|\n  puts referrer.label             # eg. \"facebook.com\"\n  puts referrer.visits            # Number of times a visit came from this referrer\n  puts referrer.actions_per_visit # Average number of actions that occurred during a visit\nend\n```\n\n**Visited Pages** show the top pages within the application, both in terms of unique page views and overall number of hits. Usage example:\n```ruby\n# Get the top pages under a certain path, for example under \"/articles\"\npages = Matomo::Page.under_path(\"/articles\")\n\n# Access information about each page\npages.each() do |page|\n  puts page.label # eg. \"/harm-reduction\"\n  puts page.path # eg. \"/acticles/harm-reduction\"\n  puts page.hits # Overall number of hits on the page\n  puts page.visits # The number of distinct visits to the page\nend\n\n# Get views for a certain page, grouped by day\n# Return format eg. { \"2018-10-03\": \u003cMatomo::Page\u003e, \"2018-10-04\": \u003cMatomo::Page\u003e, etc. }\npages = Matomo::Page.group_by_day(\"/articles/harm-reduction\",\n                                      start_date: Time.now - 1.month, end_date: Time.now)\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefforg%2Feff_matomo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fefforg%2Feff_matomo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefforg%2Feff_matomo/lists"}