<commit_before># middleman-google-analytics

[![Gem Version](https://badge.fury.io/rb/middleman-google-analytics.svg)](http://badge.fury.io/rb/middleman-google-analytics)
[![Dependency Status](https://gemnasium.com/danielbayerlein/middleman-google-analytics.svg)](https://gemnasium.com/danielbayerlein/middleman-google-analytics)

middleman-google-analytics is a [Middleman](http://middlemanapp.com)
extension that generates Google Analytics tracking code, and keeps your config
in `config.rb`, where it belongs.

## Installation

If you already have a Middleman project:

Add `gem "middleman-google-analytics"` to your `Gemfile` then open up your
`config.rb` and add:

```ruby
# Activate google-analytics extension
activate :google_analytics do |ga|
  ga.tracking_id = 'UA-XXXXXXX-X'
end
```

Then, in your layout, after your footer, call `google_analytics_tag` and
include the results in the page. For example, in Haml:

```haml
= google_analytics_tag
```

Or ERB:

```erb
<%= google_analytics_tag %>
```

### Configuration

```ruby<commit_msg>face-lift<commit_after># middleman-google-analytics

[![Gem Version](https://badge.fury.io/rb/middleman-google-analytics.svg)](http://badge.fury.io/rb/middleman-google-analytics)
[![Dependency Status](https://gemnasium.com/danielbayerlein/middleman-google-analytics.svg)](https://gemnasium.com/danielbayerlein/middleman-google-analytics)

**middleman-google-analytics** is a [Middleman](http://middlemanapp.com)
extension that generates
[Google Analytics](https://www.google.de/intl/en/analytics/) tracking code, and
keeps your config in `config.rb`, where it belongs.

## Installation

1. Specify the dependency in your project's `Gemfile`:

  ```ruby
  # Gemfile
  gem "middleman-google-analytics"
  ```

2. Activate the Google Analytics extension in your project's `config.rb`:

  ```ruby
  # config.rb
  activate :google_analytics do |ga|
    ga.tracking_id = 'UA-XXXXXXX-X'
  end
  ```

3. In your layout, after your footer, call `google_analytics_tag` or
   `google_analytics_universal_tag` and include the results in the page:

  **Haml:**

  ```haml
  # Google Analytics
  = google_analytics_tag
  ```

  ```haml
  # Universal Analytics
  = google_analytics_universal_tag
  ```

  **ERB:**

  ```erb
  <% # Google Analytics %>
  <%= google_analytics_tag %>
  ```

  ```erb
  <% # Universal Analytics %>
  <%= google_analytics_universal_tag %>
  ```

## Configuration

```ruby
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0012350761630300535, 'mean_word_length': 4.841346153846154, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 7, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '2689089', 'n_tokens_mistral': 865, 'n_tokens_neox': 806, 'n_words': 181}