akio-browser
The Akio JavaScript SDK is used to collect web analytics for decentralized applications.
Last updated 6 months ago by negativetwelve .
Original npm · Tarball · package.json
$ cnpm install akio-browser 
SYNC missed versions from official npm registry.

Akio JavaScript SDK

The Akio JavaScript SDK is used to collect web analytics for decentralized applications.

Installation

This library is available as a package on NPM. To add to your project, run:

yarn add akio-browser

Getting Started

To get started, import the Akio object from akio-browser like a normal Node.js module.

// Step 1: Import the library.
import Akio from 'akio-browser';

// Step 2: Initialize Akio with your token that you created on Akio Insights.
const akio = await Akio.init({
  token: 'your-token-here',
});

// Step 3: Identify a unique user by passing in a required userId and an optional userAddress.
// If your app has no concept of a userId, you may provide the userAddress for both fields.
// Passing in a userAddress will automatically link your user with on-chain data.
await akio.identify({
  userId: 'user@example.com',
  userAddress: '0xdf215d5794bd2fb6eab88d05aabcbc8766ef4480',
});

// Step 4: Track a web event by passing in the event name.
await akio.track({
  event: 'Viewed Home Page',
});

Options

The Akio object contains 3 main methods:

Init

Initialize the Akio instance by providing your token. You can get a token by creating an account on Akio Insights.

const akio = Akio.init({
  token: 'your-token-here',
});

Other init options:

Option Values Description
verbose true / false Set to true to enable verbose logging.
debug true / false Set to true to enable debug logging.
persistence 'cookie' / 'localStorage' Specify the preferred storage medium for tracking sessions.

Identify

To identify a specific user on your application, provide a unique userId for each user. You may also pass a user's wallet address as userAddress to automatically join with on-chain data on Akio Insights.

Additional properties supplied to the identify method will be saved on the user object and viewable on a user's profile.

akio.identify({
  userId: 'user@example.com',
  userAddress: '0xdf215d5794bd2fb6eab88d05aabcbc8766ef4480',
});

Track

To track an event, simply provide an event name to the track call. Browser information is automatically logged with each event so the only required argument is the event name.

Additional properties supplied to the track method will be saved and associated with this event. All event properties are viewable on the live view for your app on Akio Insights.

akio.track({
  event: 'Viewed Home Page',
});

Contact

If you have any questions or would like to get early-access to the SDK, contact us at team@akiolabs.com.

Current Tags

  • 0.6.0-alpha.0                                ...           alpha (6 months ago)
  • 0.6.0                                ...           latest (6 months ago)

9 Versions

  • 0.6.0                                ...           6 months ago
  • 0.6.0-alpha.0                                ...           6 months ago
  • 0.5.0                                ...           6 months ago
  • 0.4.0                                ...           7 months ago
  • 0.3.0                                ...           7 months ago
  • 0.2.0                                ...           7 months ago
  • 0.1.0                                ...           7 months ago
  • 0.0.2                                ...           7 months ago
  • 0.0.1                                ...           7 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (6)
Dev Dependencies (5)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |