0.19.0 • Published 5 years ago
@arcblock/analytics-js v0.19.0
@arcblock/analytics-js
Analytics Javascript SDK for ArcBlock for both Node.js and Browser
If you are using this SDK in browser environment, babel-polyfill is required.
Table of Contents
Install
npm install @arcblock/analytics-js
// or
yarn add @arcblock/analytics-js
Usage
In Browser
const SDK = require('@arcblock/analytics-js');
// init client
SDK.initialize('ocap_playground');
// set param
SDK.set('userId', 123455);
// all param values are converted to underscore_case
const result = await SDK.event({
category: 'interaction', // only `activity` and `interaction` supported
action: 'click',
type: 'button',
label: 'run_query',
data: {},
});
const result2 = await SDK.pageview('/');
Browser Compatibility
TO BE DONE
In Node.js
Usually on server side
const express = require('express');
const ABA = require('@arcblock/analytics-js');
const app = express();
app.use(ABA.initializeExpress('ocap_widget'));
app.use(async (req, res, next) => {
// in production, you should not wait for event sending complete
const result = await req.ABA.event({
category: 'activity', // only `activity` and `interaction` supported
action: 'submit',
type: 'order',
label: '123456',
data: {},
});
res.jsonp(result);
});
app.listen(3000, () => console.log('server started'));
0.19.0
5 years ago
0.18.0
5 years ago
0.17.2
5 years ago
0.17.1
5 years ago
0.17.0
5 years ago
0.16.0
5 years ago
0.15.0
5 years ago
0.14.0
5 years ago
0.13.0
5 years ago
0.12.4
6 years ago
0.12.0
6 years ago
0.11.5
6 years ago
0.11.4
6 years ago
0.11.3
6 years ago
0.11.0
6 years ago
0.10.4
6 years ago
0.10.3
6 years ago
0.10.2
6 years ago
0.10.1
6 years ago
0.10.0
6 years ago
0.9.3
6 years ago
0.9.2
6 years ago
0.9.1
6 years ago
0.9.0
6 years ago
0.8.5
6 years ago
0.8.4
6 years ago
0.8.3
6 years ago
0.8.2
6 years ago
0.8.1
6 years ago
0.7.1
6 years ago
0.6.0
6 years ago
0.5.4
6 years ago
0.5.3
6 years ago
0.5.2
6 years ago
0.5.0
6 years ago
0.4.0
6 years ago
0.3.12
6 years ago
0.3.10
6 years ago
0.3.9
6 years ago
0.3.8
6 years ago
0.3.6
6 years ago
0.3.5
6 years ago
0.3.4
6 years ago
0.3.3
6 years ago
0.3.2
6 years ago