Handlebars helper for adding Google Analytics scripts to the head and/or footer of a webpage.
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']
}
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:
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.
Jon Schlinkert
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on July 11, 2014.