handlebars-helper-analytics

Handlebars helper for adding Google Analytics scripts to the head and/or footer of a webpage

Showing:

Popularity

Downloads/wk

2

GitHub Stars

7

Maintenance

Last Commit

7yrs ago

Contributors

2

Package

Dependencies

0

Size (min+gzip)

0.8KB

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

{{analytics}} NPM version

Handlebars helper for adding Google Analytics scripts to the head and/or footer of a webpage.

Install

Install with npm:

npm i handlebars-helper-analytics --save-dev

To use with Assemble, make sure you also specify the helper in the Assemble options, e.g.:

options: {
  helpers: ['handlebars-helper-analytics']
}

Usage

{{analytics [context] [placement]}}

Assuming you have the following data object:

google: {
  analytics: {
    account: "UA-XXXXXX",
    domain: "assemble.github.io"
    siteid: "XXXXXXX"
  }
}

You would pass the google.analytics object as context to the helper, like this:

{{analytics google.analytics 'head'}}
{{analytics google.analytics 'footer'}}

placement

  • head will render the script that should be used in the <head></head>
  • footer will render the script that should be used in the footer, e.g. last thing inside the <body></body> tag.

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license


This file was generated by verb-cli on July 11, 2014.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100