Forums/Community: Question and Answers/Product API

Statistics API

Max Ciccotosto
posted this on February 17, 2011 09:06 pm

Each domain has statistics publicly available by using the stats api.

The following parameters are required on all requests:
start and end: The date range over which you want statistics summarized.  Both of these parameters must be formatted at YYYY-MM-DD.

And the following are optional:

page: (default is 1) which page of results you'd like to see
domains
: (default is all) a comma-seperated list of domains you'd like to filter on
username: if you'd like to see all of your domains, and only yours, you can use the username that you use to login to the admin.

There are three different ways to access this information, depending on the format you use:

1. http://productportals.wishpot.com/stats_api.xml?start=<date>&end=<another date>
This will get you the results in xml, perfect if you decide to consume it in the context of a web application

2. http://productportals.wishpot.com/stats_api.html?start=<date>...
This will show an interactive page that allows you to visually view stats for domains, page through them, and download them in a csv file.

3. http://productportals.wishpot.com/stats_api.csv?start=...
If you'd rather just get the csv file without visiting a page, you can use this endpoint.

Note about CSV endpoint performance
Steps have been taken to improve the performance of the csv endpoint.  Most notably, if you are accustomed to the amount of data given by a standard weekly report, you'll notice the amount of information here is abbreviated.  This is to make the csv generation move faster.  Even then, depending on the amount of domains and the dates you request stats for, its possible this action could take awhile (as long as10-15 seconds). 

Simple example (can see in a browser):

http://productportals.wishpot.com/stats_api.xml?start=2010-6-1&amp;...

Example of xml request with curl and a POST:

$ curl -F 'domains=harddrives.com,tennisrackets.com' "http:/productportals.wishpot.com/stats_api.xml?start=2010-6-1&end=2010-6-3"

<?xml version="1.0" encoding="UTF-8"?> 
<summary>
<totalResults>2</totalResults>
<totalPages>1</totalPages>
<stats>
<domain>
<name>harddrives.com</name>
<pageviews>177</pageviews>
<unique_pageviews>146</unique_pageviews>
<visits>49</visits>
<clicks>27</clicks>
<revenue>6.1488</revenue>
</domain>
<domain>
<name>tennisrackets.com</name>
<pageviews>79</pageviews>
<unique_pageviews>61</unique_pageviews>
<visits>24</visits>
<clicks>17</clicks>
<revenue>2.3464</revenue>
</domain>
</stats>
</summary>