GET
/users-by-id/:custom_id/ping_hits/Get user page visits
You can return all user’s page visits.
| Attributes | Type | Required | Description |
|---|---|---|---|
| custom_id | integer | yes | The unique identifier for the user which is provided by the client. |
Request
- CURL
- JavaScript
- PHP
- Python
curl -X GET -H "Authorization: Token <your_64_char_api_key>"
-H "Accept: */*; version=2"
"https://<your_app_subdomain>.user.com/api/public/users-by-id/:custom_id/ping_hits/"
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://<your_app_subdomain>.user.com/api/public/users-by-id/:custom_id/ping_hits/");
xhr.setRequestHeader("authorization", "Token <your_64_char_api_key>");
xhr.setRequestHeader("accept", "*/*; version=2");
xhr.send(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/users-by-id/:custom_id/ping_hits/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"Accept: */*; version=2",
"authorization: Token <your_64_char_api_key>"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import http.client
conn = http.client.HTTPSConnection("<your_app_subdomain>.user.com")
payload = ""
headers = { 'authorization': "Token <your_64_char_api_key>", "Accept": "*/*; version=2" }
conn.request("GET", "/api/public/users-by-id/:custom_id/ping_hits/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Response
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 6840283,
"client": 490,
"ip_address": "12.34.56.78",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36",
"browser_family": "Chrome",
"browser_version": "52.0.2743",
"os_type": "Windows",
"city": "New York",
"country": "United States",
"url": "http://mydomain.com/page2.html",
"referer": "",
"timestamp": "2016-09-07T08:16:08.860725Z",
"extra_data": "{u'boolean_attribute': u'1'}",
"timezone": "America/New_York",
"resolution": "1920x938"
},
{
"id": 6210852,
"client": 490,
"ip_address": "12.34.56.78",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36",
"browser_family": "Chrome",
"browser_version": "52.0.2743",
"os_type": "Windows",
"city": "New York",
"country": "United States",
"url": "http://mydomain.com/page1.html",
"referer": "",
"timestamp": "2016-08-31T12:22:49.549081Z",
"extra_data": "{u'boolean_attribute': u'1'}",
"timezone": "America/New_York",
"resolution": "1920x938"
}
]
}