{{analytics}}
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
License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on July 11, 2014.