Templating methods for rendering the analytics.js snippet.


Render the analytics.js snippet.

var snippet = require('snippet');
var contents = snippet.max({
  host: '',
  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 hosted
  • apiKey: the apiKey to load in the snippet
  • page: the options to pass to if page is false, then the page() call will be omitted

Returns the minified version of the snippet.