Render the analytics.js snippet using ES6 templates, without using handlebars of minification
The original segment.io snippet generator is great, however, it was giving my webpack build chain heartburn. So, this version was created.
It puts the burden of minification on your build chain.
var snippet = require('snippet');
var contents = snippet.max({
host: 'cdn.segment.com',
apiKey: '03fwkuu3',
page: {
category: 'Docs',
name: 'Integrations',
properties: {
foo: 'bar'
}
}
});
Returns the maxified version of the analytics.js snippet given a set of options
:
host
: the domain name where the analytics.js script is hostedapiKey
: theapiKey
to load in the snippetpage
: the options to pass toanalytics.page
. ifpage
isfalse
, then thepage()
call will be omitted
- Babel ES6