Skip to content

jordanh/segmentio-snippet-lite

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

segmentio-snippet-lite

Render the analytics.js snippet using ES6 templates, without using handlebars of minification

Why?

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.

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 hosted
  • apiKey: the apiKey to load in the snippet
  • page: the options to pass to analytics.page. if page is false, then the page() call will be omitted

Requirements

  • Babel ES6

About

Render the analytics.js snippet.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%