2.0.4 • Published 5 years ago

altumanalytics v2.0.4

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

AltumAnalytics.js

AltumAnalytics.js is designed to collect customer data and send it to machine learning service for future processing.

We prefer to associate our library with a smart advisor called Altum.

Altum helps you measure your users, product, and business. It calculates statistic for your business and generate advises about your customers, provide charts and different integrations.

Documentation

Installation

Install from NPM

npm install --save altumanalytics

or if you want to specify version:

npm install --save altumanalytics@version      (i.e. npm install --save altumanalytics@2.0.2)

Include the library via script or manually and initialize it

The library is exported as a Universal Module (UMD), so there are couple ways of using it.

Ideally you would use module loader or compilation step to import using ES6 modules as:

import { Altum } from 'altumanalytics';

Altum.init({productId: 'PRODUCT ID', groupId: 'GROUP_ID', userId: 'USER ID'/*, options:{}*/});

In CommonJS modules then the library can be used as

const Altum = require('altumanalytics').Altum;

Altum.init({productId: 'PRODUCT ID', groupId: 'GROUP_ID', userId: 'USER ID'/*, options:{}*/});

or even using AMD script loading

define(['altumanalytics'] , function (module) {
  const Altum = module.Altum;

  Altum.init({productId: 'PRODUCT ID', groupId: 'GROUP_ID', userId: 'USER ID'/*, options:{}*/});
  // do whatever you want
});

And if you don't have any js environment setup, you can just include the library in the <head> tag using script below.

<script type="text/javascript">
      (function(t,e,r,o,u,a,m,n){t[a]=t[a]||{s:!1};
      t[a].s||(t[a].s=!0,t[a]['init']=function(c){t[a].c=c},r('load',function(){
        m=e.createElement(o);m.type="text/javascript";m.async=!0;m.src=u;
        n=e.getElementsByTagName(o)[0];n.parentNode.insertBefore(m,n)},!1));
      })(window,document,addEventListener,'script','https://cdn.jsdelivr.net/npm/altumanalytics@latest/lib/altumanalytics.min.js','Altum');

      Altum.init({
        productId:"PRODUCT ID",
        userId:"USER ID",
        groupId: "GROUP_ID",
        options:{ bufferSize: 20 }
      });
</script>

Instead of using npm you can also get library script from public CDNs: https://unpkg.com/, (i.e. https://unpkg.com/altumanalytics@latest/lib/altumanalytics.min.js) or https://cdn.jsdelivr.net/ (i.e. https://cdn.jsdelivr.net/npm/altumanalytics@latest/lib/altumanalytics.min.js)

After installation two global variables will be extractred: Altum - instance of the library and AltumAnalytics - module definition.

Initialization

Altum is exported as the Singleton, so you don't need to create a new instance.

Call Altum.init to initialize library.

  Altum.init(configurationObject);

configurationObject contains next properties:

Property NameTypeRequiredDescription
productIdStringRequiredYour unique product Id. Exception will be thrown if not provided.
groupIdStringRequiredUnique identifier per license.
userIdStringRequiredCurrently signed in userId. (Usually Db Key).
optionsObjectOptionalOptional object with additional settings (see notice below).

options is the optional object with next properties:

Property NameTypeDescriptionDefault Value
bufferSizeNumberSpecify the size of buffer to store events before sending them to server.20

Note: Altum.init method can be called several times to change current product or current user.

Examples:

Init library after user sign in and specify the product:

Altum.init({productId: 'test', groupId: '1234', userId: '12345'});

Init library with custom buffer size:

Altum.init({productId: 'test', groupId: '1234', userId: '12345', options: {bufferSize: 5}});
2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

1.2.16

5 years ago

1.2.15

5 years ago

1.2.14

5 years ago

1.2.13

5 years ago

1.2.12

5 years ago

1.2.11

5 years ago

1.2.10

5 years ago

1.2.9

5 years ago

1.2.8

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago