<commit_before># Analytics.js-Rails

A self-hosted copy of [Analytics.js](https://github.com/segmentio/analytics.js), a wrapper for web analytics services, for the Ruby on Rails 3.1+ asset pipeline.

Service A is good at X and Service B is good at Y, unfortunate but true. Use one common interface to standardize and modularize analytics setup across services.

## Installation

Add this line to your application's Gemfile:

    gem 'analytics-js-rails'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install analytics-js-rails

## Usage

Render the loader partial on all pages where you want Analytics.js to load. Typically this is done in application.html.erb, immediately after the opening <body> tag. For example:

    <%= render 'analytics-js/loader', 
      user_identifier: current_user.id, 
      providers: { 
        'Google Analytics' => 'google_analytics_key',
        'KISSmetrics' => 'kissmetrics_key'
    } %>

Of course, keys should probably be stored in config files, not hard coded.

Add to your ```config/environments/production.rb```:

    config.assets.precompile += %w( analytics.js )

You can now use Analytics.js in your app.

## Version

The version of this gem reflects the Analytics.js version.

## Contributing

Yes, please. Pull requests are very welcome. If it's not tested, we will not pull it.

1. Fork it<commit_msg>Update gem description and add #Thanks section.<commit_after># Analytics.js-Rails

This gem packages a self-hosted copy of [Analytics.js](https://github.com/segmentio/analytics.js), a wrapper for web analytics services, for use with the Ruby on Rails 3.1+ asset pipeline.

The unfortunate truch: Analytics Service A is good at X, bad at Y, Analytics Service B is good at Y, bad at X and Z. Or maybe Marketing likes Service A, but Engineering needs Service B. Whatever. Analytics.js offers one common interface to standardize and modularize analytics setup across services - now easily in rails.

## Installation

Add this line to your application's Gemfile:

    gem 'analytics-js-rails'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install analytics-js-rails

## Usage

Render the loader partial on all pages where you want Analytics.js to load. Typically this is done in application.html.erb, immediately after the opening <body> tag. For example:

    <%= render 'analytics-js/loader', 
      user_identifier: current_user.id, 
      providers: { 
        'Google Analytics' => 'google_analytics_key',
        'KISSmetrics' => 'kissmetrics_key'
    } %>

Of course, keys should probably be stored in config files, not hard coded.

Make sure that you ```root :to => "controller#action"``` in ```config/routes.rb```.

Add to your ```config/environments/production.rb```:

    config.assets.precompile += %w( analytics.js )

You can now use Analytics.js in your app.

## Version

The version of this gem reflects the Analytics.js version.

## Thanks

To the folks at [segment.io](http://segment.io) for all their work on Analytics.js - to a more panoptical world!

## Contributing

Yes, please. Pull requests are very welcome. If it's not tested, we will not pull it.

1. Fork it
{'fraction_non_alphanumeric': 0.08773584905660377, 'fraction_numerical': 0.0018867924528301887, 'mean_word_length': 3.6848306332842413, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 12, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7089602', 'n_tokens_mistral': 934, 'n_tokens_neox': 882, 'n_words': 396}