3.1.0 • Published 9 years ago
segmentio-snippet v3.1.0
snippet
Render the analytics.js snippet.
Example
var snippet = require('snippet');
var contents = snippet.max({
host: 'cdn.segment.com',
apiKey: '03fwkuu3',
page: {
category: 'Docs',
name: 'Integrations',
properties: {
foo: 'bar'
}
}
});
API
snippet.max(options)
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
snippet.min(options)
Returns the minified version of the snippet.