Get traffic headline
curl --request GET \
--url https://api.khaime.com/api/v1/analytics/headline \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.khaime.com/api/v1/analytics/headline"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.khaime.com/api/v1/analytics/headline', 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://api.khaime.com/api/v1/analytics/headline",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$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://api.khaime.com/api/v1/analytics/headline"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.khaime.com/api/v1/analytics/headline")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.khaime.com/api/v1/analytics/headline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyStore Data
Get traffic headline
Revenue, visitors, completed checkouts and conversion rate, each against the previous period.
GET
/
api
/
v1
/
analytics
/
headline
Get traffic headline
curl --request GET \
--url https://api.khaime.com/api/v1/analytics/headline \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.khaime.com/api/v1/analytics/headline"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.khaime.com/api/v1/analytics/headline', 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://api.khaime.com/api/v1/analytics/headline",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$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://api.khaime.com/api/v1/analytics/headline"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.khaime.com/api/v1/analytics/headline")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.khaime.com/api/v1/analytics/headline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyRevenue, visitors, completed checkouts and conversion rate for a range. Each figure comes with the previous period of the same length. Available on every plan.
Call this from your server with a
pk_ key. See Store data overview for keys, errors and how to read empty values.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
range | string | No | today, 7d, 30d or 90d. Default 30d. |
Request
curl -H "X-API-Key: $KHAIME_API_KEY" \
"https://api.khaime.com/api/v1/analytics/headline?range=7d"
Response
{
"message": "Headline retrieved",
"success": true,
"status": true,
"data": {
"environment": "live",
"range": "7d",
"currency": "USD",
"other_currencies": [
{
"currency": "NGN",
"amount": 1250000
}
],
"revenue": {
"current": 116071,
"previous": 98000,
"change_percent": 18.4
},
"completed_checkout": {
"current": 14,
"previous": 12,
"change_percent": 16.7
},
"conversion_rate": 2.3,
"visitors": {
"current": 602,
"previous": 540,
"change_percent": 11.5,
"tracked": true
}
}
}
Read it correctly
revenueis in hundredths ofcurrency.other_currencieslists other currencies separately. They are never added torevenue.change_percentisnullwhen the previous period was empty.conversion_rateis a percentage, ornullwhen it cannot be measured. It is not 0.visitors.trackedisfalsewhen no tracker is running. Allvisitorsfigures are thennull.- Visitors are not split into live and sandbox. Revenue and checkouts are.
