Skip to content
Handlebars helper for the analytics.js snippet
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
History.md
Readme.md
index.js
package.json

Readme.md

hbs-analyticsjs-snippet

Handlebars helper for the analytics.js snippet.

Installation

$ npm install hbs-analyticsjs-snippet

Example

var snippet = require('hbs-analyticsjs-snippet');
var hbs = require('hbs');

hbs.registerHelper('analyticsjs', snippet('WRITE_KEY'));
 <script>
    {{ analyticsjs }}
  </script>

API

snippet(writeKey, options)

Creates a handlebars helper for the analytics.js snippet, with a writeKey and custom options:

{
  min: true, // minified snippet by default
  host: 'd2dq2ahtl5zl1z.cloudfront.net' // where your analytics.js is hosted
}

License

WWWWWW||WWWWWW
 W W W||W W W
      ||
    ( OO )__________
     /  |           \
    /o o|    MIT     \
    \___/||_||__||_|| *
         || ||  || ||
        _||_|| _||_||
       (__|__|(__|__|
Something went wrong with that request. Please try again.