Retention
Query Frequency Report
Get data about how frequently users are performing events
GET
/
retention
/
addiction
Query Frequency Report
curl --request GET \
--url https://{regionAndDomain}.com/api/query/retention/addiction \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://{regionAndDomain}.com/api/query/retention/addiction"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://{regionAndDomain}.com/api/query/retention/addiction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{regionAndDomain}.com/api/query/retention/addiction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{regionAndDomain}.com/api/query/retention/addiction"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{regionAndDomain}.com/api/query/retention/addiction")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{regionAndDomain}.com/api/query/retention/addiction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"data": {
"2012-01-01": [
305,
107,
60,
41,
32,
20,
12,
7,
4,
3,
3,
3,
2,
2,
2,
1,
1,
1,
1,
1,
1,
1,
1,
1
],
"2012-01-02": [
495,
204,
117,
77,
53,
36,
26,
20,
12,
7,
4,
3,
3,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0
]
}
}Get data about how frequently users are performing events.
Let’s breakdown an example response. If you specify
One day’s worth of data is shown for each date, split into hours. On 2012-01-02, 495 users did the event
day as “unit” and hour as “addiction_unit”, you will get a response that looks like this:
{
"2012-01-01": [
305, 107, 60, 41, 32, 20, 12, 7, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
1, 1
],
"2012-01-02": [
495, 204, 117, 77, 53, 36, 26, 20, 12, 7, 4, 3, 3, 1, 1, 1, 1, 0, 0, 0, 0,
0, 0, 0
],
"2012-01-03": [
671, 324, 176, 122, 81, 63, 48, 31, 21, 14, 9, 5, 3, 1, 1, 1, 0, 0, 0, 0, 0,
0, 0, 0
]
}
Viewed report during at least 1 hour out of the next 24 hour period (the period specified by unit). 204 users did the event during at least 2 hours. 117 users did the event during at least 3 hours.
The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.Query Parameters
An expression to filter the returning events by. See the expressions section above.
The property expression to segment the second event on. See the expressions section above.
Was this page helpful?
Query Frequency Report
curl --request GET \
--url https://{regionAndDomain}.com/api/query/retention/addiction \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://{regionAndDomain}.com/api/query/retention/addiction"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://{regionAndDomain}.com/api/query/retention/addiction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{regionAndDomain}.com/api/query/retention/addiction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{regionAndDomain}.com/api/query/retention/addiction"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{regionAndDomain}.com/api/query/retention/addiction")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{regionAndDomain}.com/api/query/retention/addiction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"data": {
"2012-01-01": [
305,
107,
60,
41,
32,
20,
12,
7,
4,
3,
3,
3,
2,
2,
2,
1,
1,
1,
1,
1,
1,
1,
1,
1
],
"2012-01-02": [
495,
204,
117,
77,
53,
36,
26,
20,
12,
7,
4,
3,
3,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0
]
}
}