Skip to content

helpers/handlebars-helper-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

{{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.

About

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

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  
  •  

Packages

No packages published