Coder Social home page Coder Social logo

jekyll-metrics's Introduction

JekyllMetrics

Build Status Gem Version

A Jekyll plugin to inject Google Analytics and Yandex Metrica counters into your pages

Installation

Add this line to your application's Gemfile:

gem 'jekyll-metrics'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install jekyll-metrics

Usage

The scripts will be automatically injected to the top of your pages as soon as the plugin is enabled:

  • Above the first <script> in the <head> tag;
  • Or just to the bottom of the <head> tag if no other scripts are loaded;

To enable the plugin, add it to the list of plugins:

plugins:
  ...
  - jekyll-metrics

To make the plugin work properly, the following configuration options should be added to your _config.yml file:

jekyll_metrics:
  yandex_metrica_id: 11111111,
  google_analytics_id: 22-222222222-2

The 11111111 should be replaced with your personal Yandex Metrica counter ID and the 22-222222222-2 - with one from your Google Analytics account accordinately.

Advanced configuration

Actually the plugin may be used to inject any script you like. You'll just need to replace the template of the substitution scripts. To do so create a file (e.g. _includes/metrics.html.liquid) in your site directory and add an extra parameter to the configuration section described above:

jekyll_metrics:
  template: _includes/metrics.html.liquid
  yandex_metrica_id: 11111111,
  google_analytics_id: 22-222222222-2

Development

After checking out the repo, run rake spec to run the tests.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/zinovyev/jekyll-metrics. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the JekyllMetrics project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

jekyll-metrics's People

Contributors

dependabot[bot] avatar zinovyev avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.