Segmentation
Query Segmentation Report
Segment an event by property via the legacy Segmentation Query API, now in maintenance mode; use an Insights report instead
GET
/
segmentation
Query Segmentation Report
curl --request GET \
--url https://{regionAndDomain}.com/api/query/segmentation \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://{regionAndDomain}.com/api/query/segmentation"
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/segmentation', 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/segmentation",
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/segmentation"
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/segmentation")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{regionAndDomain}.com/api/query/segmentation")
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": {
"series": [
"2011-08-08",
"2011-08-09",
"2011-08-06",
"2011-08-07"
],
"values": {
"Signed up": {
"2011-08-06": 147,
"2011-08-07": 146,
"2011-08-08": 776,
"2011-08-09": 1376
}
}
},
"legend_size": 1
}❗️The Segmentation Query API is in maintenance mode. We recommend discontinuing new use of this endpoint. To break down and filter event data, build an Insights report in-app and query it programmatically with the Insights Query API. For raw event data, see export methods. If you need help choosing the best method, reach out to support.
Query Parameters
The property expression to segment the event on. See the expression to segment below.
An expression to filter events by. See the expression to segment below.
This can be "general", "unique", or "average". If this is set to "unique", we return the unique count of events or property values. If set to "general", we return the total, including repeats. If set to "average", we return the average count. The default value is "general".
Available options:
general, unique, average Was this page helpful?
Query Segmentation Report
curl --request GET \
--url https://{regionAndDomain}.com/api/query/segmentation \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://{regionAndDomain}.com/api/query/segmentation"
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/segmentation', 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/segmentation",
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/segmentation"
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/segmentation")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{regionAndDomain}.com/api/query/segmentation")
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": {
"series": [
"2011-08-08",
"2011-08-09",
"2011-08-06",
"2011-08-07"
],
"values": {
"Signed up": {
"2011-08-06": 147,
"2011-08-07": 146,
"2011-08-08": 776,
"2011-08-09": 1376
}
}
},
"legend_size": 1
}