0.0.5 • Published 6 years ago

moonland-client v0.0.5

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

Moonland JS Client

The easiest way to manage complex web experiments

Installation

Browser

Download the minified library and insert it in your scripts. <script src="moonlan-js.min.js"></script>

Node.js

Install it using node or yarn npm install --save moonland-js or with yarn if you prefer yarn add moonland-js

Usage

To get started, just run create a new client

var moonland = new Moonland(options)

Example

var moonland = new Moonland({
  apiKey: '<MY_API_KEY>',
  defaults: { ... },
  units: {
    userId: 10,
    sessionId: 'a90ad8bb-6f35-4697-844d-6090529aeaf1',
  },
  mode: 'DEV',
})

The option object takes the following properties:

Accessing a parameter

In order to get the value of a parameter, simply run

var parameterValue = moonland.get(paramName)

In development, it will simply return the default value specified in the defaults object.

In production, will either return the default value or will try to allocate it according to the script defined on the server side. It will

The get function has the following signature:

moonland.get(paramName [, units ])

The function get takes the following parameters:

Tracking an event

Tracking events is easy.

moonland.track(eventName [, props] [, units] [, metrics])

In development, track will do nothing.

In production, will send the event to the servers to record the impression.

The function track takes the following parameters:

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago