Documentation

Use your NodeJS code to work with your media's analytics data. This is possible by using the analytics API methods provided bellow.

Fork me on GitHub
  • get
    Get analytics for the given params
    ZiggeoSdk.Analytics.get(arguments, [callbacks])
    
    1. from A UNIX timestamp in microseconds used as the start date of the query
    2. to A UNIX timestamp in microseconds used as the end date of the query
    3. date A UNIX timestamp in microseconds to retrieve data from a single date. If set, it overwrites the from and to params.
    4. query The query you want to run. It can be one of the following: device_views_by_os, device_views_by_date, total_plays_by_country, full_plays_by_country, total_plays_by_hour, full_plays_by_hour, total_plays_by_browser, full_plays_by_browser
    This method returns JSON
    Example:
    
    /*
    	Usage: node analytics_get.js APP_TOKEN PRIVATE_KEY QUERY
    	Sample: node analytics_get.js 1234567890abcdef 1234567890abcdef device_views_by_os
    */
    var app_token = process.argv[2];
    var app_private = process.argv[3];
    var query = process.argv[4];
    
    var Ziggeo = require("../index.js");
    var ZiggeoSdk = new Ziggeo(app_token, app_private);
    var date = new Date().getTime()
    // get all data from the beginning 
    var options ={
    	from: 0,
    	to: Date.now(),
    	query: query
    }
    ZiggeoSdk.Analytics.get (options, {
    	success: function (video) {
    		console.log (video);
    	}
    });