Documentation

Use your Python 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 = None)
    
    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:
    import sys
    import time
    from Ziggeo import Ziggeo
    
    if(len(sys.argv) < 4):
    	print ("Error\n")
    	print ("Usage: $>python analytics_get.py YOUR_API_TOKEN YOUR_PRIVATE_KEY QUERY\n")
    	print ("Example: $>python analytics_get.py 1234567890abcdef 1234567890abcdef device_view_by_os\n")
    	sys.exit()
    
    api_token = sys.argv[1]
    private_key = sys.argv[2]
    query = sys.argv[3]
    
    ziggeo = Ziggeo(api_token, private_key)
    ts = time.time()
    arguments = {}
    arguments['from'] = 0
    arguments['to'] = ts
    arguments['query'] = query
    print (ziggeo.analytics().get(arguments))