https://github.com/segmentio/hbs-analyticsjs-snippet
Handlebars helper for the analytics.js snippet
https://github.com/segmentio/hbs-analyticsjs-snippet
Last synced: 9 months ago
JSON representation
Handlebars helper for the analytics.js snippet
- Host: GitHub
- URL: https://github.com/segmentio/hbs-analyticsjs-snippet
- Owner: segmentio
- Archived: true
- Created: 2013-12-04T04:43:28.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2023-04-09T23:31:08.000Z (about 3 years ago)
- Last Synced: 2025-01-03T11:21:18.361Z (over 1 year ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 1
- Watchers: 40
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# hbs-analyticsjs-snippet
Handlebars helper for the [analytics.js](segmentio/analytics.js) snippet.
## Installation
$ npm install hbs-analyticsjs-snippet
## Example
```js
var snippet = require('hbs-analyticsjs-snippet');
var hbs = require('hbs');
hbs.registerHelper('analyticsjs', snippet('WRITE_KEY'));
```
```html
{{ analyticsjs }}
```
## API
### snippet(writeKey, options)
Creates a handlebars helper for the [analytics.js](segmentio/analytics.js) snippet, with a `writeKey` and custom `options`:
```js
{
min: true, // minified snippet by default
host: 'cdn.segment.com' // where your analytics.js is hosted
}
```
## License
```
WWWWWW||WWWWWW
W W W||W W W
||
( OO )__________
/ | \
/o o| MIT \
\___/||_||__||_|| *
|| || || ||
_||_|| _||_||
(__|__|(__|__|
```