API/Code
Quick Links
AppMetrics API
The AppMetrics API allows you to request metrics data for one of your applications.
Making a request
Requests should be of the form:
http://api.flurry.com/appMetrics/METRIC_NAME? apiAccessCode=APIACCESSCODE&apiKey=APIKEY&startDate=STARTDATE&endDate=ENDDATE &country=COUNTRY&versionName=VERSIONNAME&groupBy=GROUPBY
Where the METRIC_NAME is one of the following:
| ActiveUsers | Total number of unique users who accessed the application per day. |
| ActiveUsersByWeek | Total number of unique users who accessed the application per week. Only returns data for dates which specify at least a complete calendar week. |
| ActiveUsersByMonth | Total number of unique users who accessed the application per month. Only returns info for dates which specify at least a complete calendar month. |
| NewUsers | Total number of unique users who used the application for the first time per day. |
| MedianSessionLength | Median length of a user session per day. |
| AvgSessionLength | Average length of a user session per day. |
| Sessions | The total number of times users accessed the application per day. |
| RetainedUsers | Total number of users who remain active users of the application per day. |
| PageViews | Total number of page views per day. |
| AvgPageViewsPerSession | Average page views per session for each day. |
APIACCESSCODE is the unique code given to you to access Flurry APIs. This can be found by logging into
the Flurry website and by going to the link "manage company" (Link on the top right).
APIKEY is the unique code for each application. This can be found by logging into the Flurry website, then by going to the link "Manage Applications" and finally by selecting the application desired.
STARTDATE and ENDDATE should be in YYYY-MM-DD format.
VERSIONNAME, an optional parameter, is the name set by the developer for each version of the application. This can be found by logging into
the Flurry website or contacting support.
COUNTRY, an optional parameter, is the name of the country in abbreviated form. To find a country's abbreviation click here. Specifying a value of "ALL" or "all" for the COUNTRY will return a result which is broken down by countries.
GROUPBY, an optional parameter, changes the grouping of data into DAYS, WEEKS, or MONTHS. All metrics default to DAYS (except ActiveUsersByWeek and ActiveUsersByMonth).
Response format
Flurry APIs current support two output formats: XML and JSON.
The format of the response data depends on the value of the Accept header you send in the HTTP
request. If you specify "application/xml" you will receive an XML-formatted response similar to the following:
<appMetrics metric="ActiveUsers" version="1.0" generatedDate="3/1/10 2:10 PM"
startDate="2010-03-01" endDate="2010-04-15"/>
<day date="2010-03-01" value="123" />
<day date="2010-03-02" value="1234" />
...
</appMetrics>
<appMetrics metric="ActiveUsers" version="1.0" generatedDate="3/1/10 2:10 PM" startDate="2010-03-01" endDate="2010-04-15"/> <day date="2010-03-01" value="123" /> <day date="2010-03-02" value="1234" /> ... </appMetrics>
If you specify "application/json" you will receive a JSON-formatted response similar to the following.
{"@metric":"ActiveUsers",
"@version":"1.0",
"@generatedDate":"3/1/10 2:10 PM",
"@startDate":"2010-03-01",
"@endDate":"2010-04-15",
"day":[{"@value":"123",
"@date":"2010-03-01"},
{"@value":"1234",
"@date":"2010-03-02"},
...
]
}
{"@metric":"ActiveUsers",
"@version":"1.0",
"@generatedDate":"3/1/10 2:10 PM",
"@startDate":"2010-03-01",
"@endDate":"2010-04-15",
"day":[{"@value":"123",
"@date":"2010-03-01"},
{"@value":"1234",
"@date":"2010-03-02"},
...
]
}
In both cases, you retrieve some top level attributes:
- metric - The name of the metric you requested.
- version - The version of this response format.
- generatedDate - The date when the response was generated.
Specifying country=ALL will result in the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<appMetrics startDate="2011-08-01"
metric="Sessions"
endDate="2011-08-04"
version="1.0"
generatedDate="6/5/12 9:55 AM">
<country country="US">
<day value="10" date="2011-08-04"/>
<day value="3" date="2011-08-01"/>
</country>
</appMetrics>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <appMetrics startDate="2011-08-01" metric="Sessions" endDate="2011-08-04" version="1.0" generatedDate="6/5/12 9:55 AM"> <country country="US"> <day value="10" date="2011-08-04"/> <day value="3" date="2011-08-01"/> </country> </appMetrics>
{"@startDate":"2011-08-01",
"@metric":"Sessions",
"@endDate":"2011-08-04",
"@version":"1.0",
"@generatedDate":"6/5/12 9:50 AM",
"country":{
"@country":"US",
"day":[{"@value":"10","@date":"2011-08-04"},
...
]
}}
{"@startDate":"2011-08-01",
"@metric":"Sessions",
"@endDate":"2011-08-04",
"@version":"1.0",
"@generatedDate":"6/5/12 9:50 AM",
"country":{
"@country":"US",
"day":[{"@value":"10","@date":"2011-08-04"},
...
]
}}Error codes
If something is wrong with the request or if there is a system problem, you will recieve an error response instead of the expected response. This is signified by an HTTP response code other than 200 (OK) and is accompanied by content similar to the following:
<error>
<code>100</code>
<message>API Key not found</message>
</error>
<error> <code>100</code> <message>API Key not found</message> </error>
If you receive one of these errors and are unable to determine the cause from the message provided, please contact Flurry support (support@flurry.com) along with the error code you receive.
In some cases, a system error will occur that prevents even an error message from being returned. In these cases you will receive a 500 server failure response code.
