{"id":16726872,"url":"https://github.com/tpitale/tremolo-rails","last_synced_at":"2025-03-15T15:43:29.130Z","repository":{"id":59158034,"uuid":"52411921","full_name":"tpitale/tremolo-rails","owner":"tpitale","description":"Seamless Rails integration with Tremolo","archived":false,"fork":false,"pushed_at":"2016-05-10T22:04:44.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-22T06:34:29.426Z","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/tpitale.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-24T03:38:24.000Z","updated_at":"2016-02-25T09:08:25.000Z","dependencies_parsed_at":"2022-09-13T20:10:17.289Z","dependency_job_id":null,"html_url":"https://github.com/tpitale/tremolo-rails","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpitale%2Ftremolo-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpitale%2Ftremolo-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpitale%2Ftremolo-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpitale%2Ftremolo-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpitale","download_url":"https://codeload.github.com/tpitale/tremolo-rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243753991,"owners_count":20342537,"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-10-12T22:54:49.276Z","updated_at":"2025-03-15T15:43:29.097Z","avatar_url":"https://github.com/tpitale.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tremolo::Rails\n\nProvides seamless integration with basic tracking of rails (timing and pageviews) into the Google Analytics Measurement API.\n\n[![Build Status](https://travis-ci.org/tpitale/tremolo-rails.png?branch=master)](https://travis-ci.org/tpitale/tremolo-rails)\n[![Code Climate](https://codeclimate.com/github/tpitale/tremolo-rails.png)](https://codeclimate.com/github/tpitale/tremolo-rails)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'tremolo-rails'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install tremolo-rails\n\n## Provides\n\n* Timing from instrumentation (total duration, db_runtime, view_runtime)\n* Pageview tracking\n* Tracker hook in controllers that can use a generated UUID request session `client_id`\n* Exception tracking (tracks the exception name and line/file if available)\n\nSession UUID for the `client_id` is handled for you. Can be overridden easily, see [Overriding the client_id](https://github.com/tpitale/tremolo-rails#overriding-the-client_id).\n\n## Usage\n\nIn environments/production.rb (leave blank in development/test to not track):\n\n```ruby\nconfig.tremolo.trackers \u003c\u003c ['0.0.0.0', 4444]\n```\n\nIn controllers, `tracker` is made available to you:\n\n```ruby\ntracker.increment('count.series-name')\n```\n\n## Named trackers ##\n\nIn the example above, the tracker is named `default`. If you wish, you can make multiple trackers, each with a name.\n\n```ruby\nconfig.tremolo.trackers \u003c\u003c ['0.0.0.0', 4444] # default\nconfig.tremolo.trackers \u003c\u003c [:secondary, '0.0.0.0', 8191]\n```\n\nThis named tracker can be retrieved by passing the name to `tracker` in a controller.\n\n```ruby\ntracker(:secondary)\n```\n\nFurther options can be passed to the tracker as a hash in the last element of an array (more details on the namespace below):\n\n```ruby\nconfig.tremolo.trackers \u003c\u003c ['0.0.0.0', 4444, {namespace: 'website'}]\n```\n\n**Note:** tracker-specific namespace options will override global `namespace` configuration.\n\n## Overriding the client_id ##\n\nA method is added to your controller called `tremolo_client_id`. By default, it's implementation looks like:\n\n```ruby\nsession['tremolo.client_id'] ||= Tremolo::Rails.build_client_id\n```\n\nIf you wish to not store the `client_id` in session, or you wish to use another UUID value, you may override the method `tremolo_client_id` as you see fit.\n\n## Setting a namespace ##\n\nTo set a namespace to be used to prefix all stats for all trackers:\n\n```ruby\nconfig.tremolo.namespace = 'tremolo' # default is nil\n```\n\nThis will cause pageviews and exceptions to be tracked under the stat `tremolo.pageview` and `tremolo.exception`, for example.\n\nThe namespace can also be set per-tracker by passing it as the last argument to the configuration:\n\n```ruby\nconfig.tremolo.trackers \u003c\u003c ['0.0.0.0', 4444, {namespace: 'tremolo'}]\n```\n\n## Tracking exceptions ##\n\n```ruby\nconfig.tremolo.exceptions = true\n```\n\nTracking exceptions happens by adding to `ActionController::Base` a `rescue_from` for `Exception`. Because of this, it will only rescue exceptions that have not already been rescued from in your own code. If you wish to track those exceptions, as well, you can call `track_exception_with_tremolo(exception)` to your own `rescue_from` methods.\n\n## Disable some, or all, tracking\n\nInside of your `environment` files, as appropriate\n\n```ruby\nconfig.tremolo.timing = false # stats: runtime.total, runtime.db, runtime.view\nconfig.tremolo.pageviews = false # stats: pageview\nconfig.tremolo.exceptions = false # default, stats: exception\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpitale%2Ftremolo-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpitale%2Ftremolo-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpitale%2Ftremolo-rails/lists"}