Skip to content

Commit

Permalink
v1.0.2
Browse files Browse the repository at this point in the history
 - Fixing known issues
 - No DOM changes
 - Respect DNT
 - Code optimisation (less code, do more)
 - Support for Meteor >= 1.3.*
 - Better docs
  • Loading branch information
dr-dimitru committed Apr 6, 2016
1 parent bfcea9f commit bdc659b
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[email protected].12
ostrio:[email protected].1
[email protected].6
[email protected].13
ostrio:[email protected].2
[email protected].7
73 changes: 60 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
Analytics for [ostr.io](https://ostr.io)
=======

[Ostr.io](https://ostr.io) provides lightweight and full-featured visitor's analytics for websites.

Analytics includes:
[Ostr.io](https://ostr.io) provides lightweight and full-featured visitor's analytics for websites. Our solution fully compatible and works "*out-of-box*" with Meteor, Angular, Backbone, Ember and other front-end JavaScript frameworks.

##### Why analytics from [ostr.io](https://ostr.io)?:
- Open Source tracking code;
- Transparent data collection;
- Support for History API (*HTML5 History Management*);
- Respect [DNT](https://en.wikipedia.org/wiki/Do_Not_Track) policy;
- Lightweight, less than 5KB;
- No DOM changes;
- No heavy CPU tasks;
- No extra scripts loading;
- Global runtime Errors tracking - *Whenever error happens during runtime you will be reported into* Events *section. This is super-useful as you never can test your client's code in all imaginable environments, but your website visitors do*.

##### Analytics includes:
- Real-time users;
- Pageviews;
- Sessions;
- Avg. sessions duration;
- Pageviews / Session;
- Pageviews per Session;
- Unique users;
- Bounces and Bounce rate;
- Demographics:
- Country;
- City;
- User's language.
- User's language (locale).
- System:
- Mobile devices;
- Browsers;
Expand All @@ -34,10 +45,10 @@ All analytics data is available for half of year, quarter, month (*daily*), 3 da

Installation
=======
In control panel of your website (*at [ostr.io](https://ostr.io/en/account/servers)*) go to "Analytics" tab, and click on "How to install?". From given code you can obtain `websiteId` (*17 symbols*):
In control panel of your website (*at [ostr.io](https://ostr.io/en/account/servers)*) go to "Analytics" tab, and click on "How to install?". From given code you can obtain `trackingId` (*17 symbols*):
```html
<script async defer type="text/javascript" src="https://analytics.ostr.io/Asy4kHJndi84KKlpq.js"></script>
<!-- websiteId is: Asy4kHJndi84KKlpq -->
<!-- trackingId 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.
Expand All @@ -57,19 +68,25 @@ If you're using any compilation for NPM and/or JavaScript, all JS-source code of
Usage
=======

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

For Meteor:
Meteor:
```js
Meteor.startup(function() {
this.OstrioTracker = new OstrioTrackerClass('Asy4kHJndi84KKlpq');
this.OstrioTracker = new OstrioTrackerClass('trackingId');
});
```

For others:
Browser:
```js
var OstrioTracker = new OstrioTrackerClass('trackingId');
```

RequireJS (+AMD Module):
```js
var OstrioTracker = new OstrioTrackerClass('Asy4kHJndi84KKlpq');
var Analytics = require('ostrio-analytics');
var OstrioTracker = new Analytics('trackingId');
```

*From this point you're good to go. All visitor's actions will be collected by ostr.io analytics. For custom events - see below.*
Expand All @@ -88,3 +105,33 @@ If length of `key` or `value` is higher than limits, it will be truncated withou
Use to manually send tracking info of current page and user, to ostr.io analytics service.


Other examples
=======
##### Deep router integration:
```js
var OstrioTracker = new OstrioTrackerClass('trackingId', false);

router({
'/': function() {
OstrioTracker.track();
},

'/two': function() {
OstrioTracker.track();
},

'/three': function() {
OstrioTracker.track();
}
});
```

##### Deep History.js Integration
Although History.js and History API supported "*out-of-box*", you may want to optimize tracking behavior to meet your needs.
```js
var OstrioTracker = new OstrioTrackerClass('trackingId', false);

History.Adapter.bind(window, 'statechange', function(){
OstrioTracker.track();
});
```
6 changes: 3 additions & 3 deletions package.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Package.describe({
name: 'ostrio:analytics',
version: '1.0.1',
version: '1.0.2',
summary: 'Visitor\'s analytics tracking code for ostr.io service',
git: 'https://github.com/VeliovGroup/ostrio-analytics',
documentation: 'README.md'
});

Package.onUse(function(api) {
api.versionsFrom('1.0.1');
api.versionsFrom('1.3');
api.addFiles('./lib/analytics.js', 'client');
api.export('OstrioTrackerClass');
api.export('OstrioTrackerClass', 'client');
});
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "ostrio-analytics",
"version": "1.0.1",
"version": "1.0.2",
"description": "Visitor's analytics tracking code for ostr.io service",
"main": "./src/analytics.js",
"main": "./lib/analytics.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand Down

0 comments on commit bdc659b

Please sign in to comment.