ostrio:analytics

v1.0.1Published 8 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

Analytics for ostr.io

Ostr.io provides lightweight and full-featured visitor's analytics for websites.

Analytics includes:

  • Real-time users;
  • Pageviews;
  • Sessions;
  • Avg. sessions duration;
  • Pageviews / Session;
  • Unique users;
  • Bounces and Bounce rate;
  • Demographics:
    • Country;
    • City;
    • User's language.
  • System:
    • Mobile devices;
    • Browsers;
    • Operating System.
  • Screen:
    • Browser's window size;
    • Device screen size;
    • Screen orientation;
    • Color palette and resolution.
  • Behavior:
    • Custom events (see below);
    • Referrals;
    • Exit Pages;
    • Outgoing Links.

All analytics data is available for half of year, quarter, month (daily), 3 days (hourly), 6 hours (by minutes, real-time).

Installation

In control panel of your website (at ostr.io) go to "Analytics" tab, and click on "How to install?". From given code you can obtain websiteId (17 symbols):

1<script async defer type="text/javascript" src="https://analytics.ostr.io/Asy4kHJndi84KKlpq.js"></script>
2<!-- websiteId is: Asy4kHJndi84KKlpq -->

The simplest way is to include this script tag into head of your HTML page. Or (for better efficiency) include code from this repository into main website's script file (or install via NPM/Atmosphere), so you can have all application's code in single file.

Meteor
meteor add ostrio:analytics
NPM:
npm install ostrio-analytics --save

If you're using any compilation for NPM and/or JavaScript, all JS-source code of your application will be compiled and minified into single file.

Usage

Constructor new OstrioTrackerClass(websiteId)
  • websiteId {String} - [Required] Website identifier. For finding websiteId see "Installation" section above

For Meteor:

1Meteor.startup(function() {
2  this.OstrioTracker = new OstrioTrackerClass('Asy4kHJndi84KKlpq');
3});

For others:

1var OstrioTracker = new OstrioTrackerClass('Asy4kHJndi84KKlpq');

From this point you're good to go. All visitor's actions will be collected by ostr.io analytics. For custom events - see below.

OstrioTracker.pushEvent(key, value)

Custom events is useful for tracking certain activity on your website, like clicks, form submits and others user's behaviors.

  • key {String} - [Required] Length of event key must be between 1 and 24 symbols
  • value {String} - [Required] Length of event value must be between 1 and 64 symbols

If length of key or value is higher than limits, it will be truncated without throwing exception.

OstrioTracker.track()

Use to manually send tracking info of current page and user, to ostr.io analytics service.