No description
Find a file
Hendrik Schneider 40e09570de
Merge pull request #44 from DavidS/plausible
Add support for plausible.io
2020-10-23 15:55:01 +02:00
.github/workflows Update ruby.yml 2019-10-19 22:32:46 +02:00
lib Add support for plausible.io 2020-10-11 23:14:03 +01:00
test Fetch the correct "anonymizeIp" config 2020-01-04 12:11:56 +00:00
.gitignore added coverage 2019-10-19 22:22:55 +02:00
.travis.yml Update .travis.yml 2019-10-20 00:02:31 +02:00
Gemfile Move test gems to group 2019-12-04 13:32:48 +01:00
Gemfile.lock [Security] Bump json from 2.2.0 to 2.3.1 2020-07-01 07:20:07 +00:00
jekyll-analytics.gemspec Added Matomo tracking pixel 2019-10-19 21:20:12 +02:00
LICENSE.txt Create LICENSE.txt 2017-04-17 04:16:49 +03:00
Rakefile added coverage 2019-10-19 22:22:55 +02:00
README.md Add support for plausible.io 2020-10-11 23:14:03 +01:00
ruby.yml Rename .github/workflows/ruby.yml to ruby.yml 2019-10-19 22:34:51 +02:00
spec_helper.rb added coverage 2019-10-19 22:22:55 +02:00

Build Status Maintainability

Jekyll::analytics

Webanalytics for Jekyll.

There are many tutorials online to add analytics to Jekyll by extending the template. Jekyll-analytics is here to take care of this. Just install the plugin, configure it and you are done :)

Jekyll-analytics: Webanalytics made easy.

Supported:

Installation

Add this to your Gemfile:

gem 'jekyll-analytics'

Then execute

$ bundle

Or install it yourself

gem install jekyll-analytics

Configuration

Edit _config.yml to use the plugin:

plugins:
  - jekyll-analytics

Configure the plugin in _config.yml by adding:

jekyll_analytics:
  GoogleAnalytics:          # Add, if you want to track with Google Analytics
    id: UA-123-456          # Required - replace with your tracking id
    anonymizeIp: false      # Optional - Default: false - set to true for anonymized tracking

  Matomo:                   # Add, if you want to track with Matomo (former Piwik Analytics)
    url: matomo.example.com # Required - url to Matomo installation without trailing /
    siteId: "1234"          # Required - replace with your Matomo site id (Write id as string)

  Piwik:                    # Add, if you want to track with Piwik
    url: piwik.example.com  # Required - url to Piwik installation without trailing /
    siteId: "1234"          # Required - replace with your Piwik site id (Write id as string)

  MPulse:                   # Add if you want to track performance with mPulse
    apikey: XXXXX-YYYYY-ZZZZZ-AAAAA-23456   # Required - replace with your mPulse API key

  Plausible:
    domain: 'example.com'   # The domain configured in plausible
    source: 'https://plausible.example.com/js/plausible.js' # The source of the javascript

Usage

Tracking will be disabled in development mode. To enable production mode set enviroment variable JEKYLL_ENV=production. Github pages automatically sets JEKYLL_ENV to production. For testing use

$ JEKYLL_ENV=production jekyll serve

Contributing

  1. Fork it ( https://github.com/hendrikschneider/jekyll-analytics/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

How to add support for a new tracker:

  1. Create new tracker class in lib/analytics/YourTracker.rb
#initialize and render must be implemented!
class YourTracker
  def initialize(config)
    #validate config
  end

  def render
    return "Tracking code to insert into html > head"
  end
end
  1. Update README.md