diff --git a/.versions b/.versions index e3337d6..0bedcdb 100644 --- a/.versions +++ b/.versions @@ -1,3 +1,3 @@ -meteor@1.1.12 -ostrio:analytics@1.0.1 -underscore@1.0.6 +meteor@1.1.13 +ostrio:analytics@1.0.2 +underscore@1.0.7 diff --git a/README.md b/README.md index 3c9c067..747de5a 100644 --- a/README.md +++ b/README.md @@ -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; @@ -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 - + ``` 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. @@ -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.* @@ -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(); +}); +``` \ No newline at end of file diff --git a/package.js b/package.js index 1f8fc5a..24dd17a 100644 --- a/package.js +++ b/package.js @@ -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'); }); \ No newline at end of file diff --git a/package.json b/package.json index cd6edab..3863981 100644 --- a/package.json +++ b/package.json @@ -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" },