Documentation

Use your PHP 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
    $ziggeo->analytics()->get($arguments = array())
    
    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:
    <?php
    /*
    	This script will show you how to get analytics data for your application
    
    	Parameters you need to pass:
    	1. app_token
    	2. private_key
    	3. filter_date
    	4. filter_from
    	5. filter_to
    	6. filter_query
    */
    require_once(dirname(__FILE__) . "/../Ziggeo.php");
    
    $opts = getopt("", array("app_token:", "private_key:", "filter_date:", "filter_from:", "filter_to:", "filter_query:"));
    
    //We initialize our SDK
    $ziggeo = new Ziggeo($opts["app_token"], $opts["private_key"]);
    
    $analytics = $ziggeo->analytics()->get(array(
    	"from" => (isset($opts["filter_from"])) ? $opts["filter_from"] : NULL,
    	"to" => (isset($opts["filter_to"])) ? $opts["filter_to"] : NULL,
    	"date" => (isset($opts["filter_date"])) ? $opts["filter_date"] : NULL,
    	"query" => $opts["filter_query"]
    ));
    
    var_dump($analytics);
    
    ?>