<commit_before># Middleman Google Analytics

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


## Status

I'm not actively maintaining this project anymore.  Straightforward patches will be merged, and
simple issues will be addressed but I am interested in having a new maintainer take over the
project for less trivial changes such as adding `analytics.js` support.


## 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
activate :google_analytics do |ga|
  ga.tracking_id = 'UA-XXXXXXX-X' # property ID
  ga.debug = false # Manually set debug flag (if true, links to /u/ga_debug.js)
  ga.anonymize_ip = true # removing the last octet of the IP address
  ga.domain_name = 'example.com' # Track for (cross-domain tracking)
  ga.allow_linker = true # Multiple top-level domains (needs domain_name to be set)
end
```

## Only Including Tracking Code in Builds

To include the tracking code only in builds, and not when running
`middleman server`, simply add environment-specific configurations in your
`config.rb`:

```ruby
configure :development do
  activate :google_analytics do |ga|
    ga.tracking_id = false
  end
end

configure :build do
  activate :google_analytics do |ga|
    ga.tracking_id = 'UA-XXXXXXX-X'
  end
end
```

## Usage

Once you've bundled you should be able to run middleman as normal, and have it
display the GA tracking code.

## License

Copyright (c) 2013 <NAME>

Licensed under the terms of the MIT X11 license.  See LICENSE.
<commit_msg>Remove status - project is still maintained<commit_after># Middleman Google Analytics

Middleman-Google-Analytics is a [Middleman](https://github.com/middleman/middleman)
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
activate :google_analytics do |ga|
  ga.tracking_id = 'UA-XXXXXXX-X' # property ID
  ga.debug = false # Manually set debug flag (if true, links to /u/ga_debug.js)
  ga.anonymize_ip = true # removing the last octet of the IP address
  ga.domain_name = 'example.com' # Track for (cross-domain tracking)
  ga.allow_linker = true # Multiple top-level domains (needs domain_name to be set)
end
```

## Only Including Tracking Code in Builds

To include the tracking code only in builds, and not when running
`middleman server`, simply add environment-specific configurations in your
`config.rb`:

```ruby
configure :development do
  activate :google_analytics do |ga|
    ga.tracking_id = false
  end
end

configure :build do
  activate :google_analytics do |ga|
    ga.tracking_id = 'UA-XXXXXXX-X'
  end
end
```

## Usage

Once you've bundled you should be able to run middleman as normal, and have it
display the GA tracking code.

## License

Copyright (c) 2013 <NAME>

Licensed under the terms of the MIT X11 license.  See LICENSE.

{'fraction_non_alphanumeric': 0.0907931650089263, 'fraction_numerical': 0.00306044376434583, 'mean_word_length': 4.417127071823204, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 6, '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': '4342780', 'n_tokens_mistral': 1269, 'n_tokens_neox': 1183, 'n_words': 480}