Brands - Location Breakdown



Endpoint

GET /v1.1/brand/[BrandID]/stats/location

Description

Obtain a breakdown member activity by location with activity count for each country

Parameters
required *

apiKey *  string Your API access key
[brandID]  integer Filter to user actions and score for a specific brand
segmentID  integer Filter to user actions and score for a specific brand segment
domain  string Filter by the domain the members registered from, without the 'http' or 'www' eg. mydomain.com
country  string ISO 3166-1 alpha-2, comma separated list. eg US,CA,GB
region  string ISO 3166-1 alpha-2, only applicable if a single country is specified
period  string In format of ' ' - eg 2 Month, 1 Day, 3 Week (default: 1 Week)
period_end  string In format of ' ' - eg 2 Month, 1 Day, 3 Week (default: 1 Week)
start_date  string In format of 'YYYY-MM-DD HH:MM:SS' – start of date range for results
end_date  string In format of 'YYYY-MM-DD HH:MM:SS' – end of date range for results
members  string Only include these members, comma separated list of native IDs – eg. 811566,803186
emails  string Only include these members by email, comma separated list – eg. abc@here.com,def@there.com
anyofactivities  string The activity id or ids (comma separated), ANY OF which have been performed by the members. Append brand id in the format brandid-activityid to filter by an activity performed for a specific brand eg. 'Shared a Listen for 5 Seconds of Summer via Facebook' would be 3438697-1350
allofactivities  string The activity id or ids (comma separated), ALL OF which have been performed by each of the members. Append brand id in the format brandid-activityid to filter by an activity performed for a specific brand eg. 'Shared a Listen for 5 Seconds of Summer via Facebook' would be 3438697-1350
exclude_members  string Ignore these members, comma separated list of native IDs – eg. 811566,803186
paid_only  boolean Filter to users who have a paid service attached eg. Spotify Premium
optedin  boolean Filter to users who have opted in. Brand or Segment ID must also be provided

Sign in with your developer account to use the console, or sign up here

Example Request

curl -v -X GET "https://api.theappreciationengine.com/v1.1/brand/1234/stats/location?apiKey=0a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p"
$curl = curl_init();

curl_setopt_array($curl, array( 
	CURLOPT_URL => "https://api.theappreciationengine.com/v1.1/brand/1234/stats/location?apiKey=0a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p", 
	CURLOPT_RETURNTRANSFER => true, 
	CURLOPT_ENCODING => "", 
	CURLOPT_MAXREDIRS => 10, 
	CURLOPT_TIMEOUT => 0, 
	CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, 
	CURLOPT_CUSTOMREQUEST => "GET", 
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import requests

url = "https://api.theappreciationengine.com/v1.1/brand/1234/stats/location?apiKey=0a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p"

headers = {}
payload = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text.encode('utf8'))
var request = require('request');
var options = {
	'method': 'GET',
	'url': 'https://api.theappreciationengine.com/v1.1/brand/1234/stats/location?apiKey=0a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p',
	'headers': {}
};
request(options, function (error, response) {
	if (error) throw new Error(error);
	console.log(response.body);
});

Example Response

{
"TotalActivities": 1365,
"TotalMembers": 548,
"Countries": [
{
"Country": "BR",
"CountryName": "Brazil",
"Actions": "15",
"Members": "6"
},
{
"Country": "CA",
"CountryName": "Canada",
"Actions": "70",
"Members": "27"
},
{
"Country": "GB",
"CountryName": "United Kingdom",
"Actions": "46",
"Members": "14"
},
{
"Country": "US",
"CountryName": "United States",
"Actions": "1234",
"Members": "501"
}
]
}