POST/ site-views/
Create page visit
You can create a page visit occurrence associated with a specific user.
Attributes
Optional unless marked required
- client_user
- A unique identifier (12 random characters) for the user which is given by User automatically.
- page_domain
- A URL of a website.
- page_path
- A path (exact location of a page) visited by a user.
- timestamp
- A unix format timestamp of a user visit.
Request
- cURL
- JavaScript
- PHP
- Python
curl -X POST "https://<your_app_subdomain>.user.com/api/public/site-views/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2" \
-H "Content-Type: application/json" \
-d '{
"client_user": "dlfpgqe5r6yu",
"page_domain": "https://example.com",
"page_path": "/pricing",
"timestamp": "2026-11-10T09:32:46.576Z"
}'
const response = await fetch(
"https://<your_app_subdomain>.user.com/api/public/site-views/",
{
method: "POST",
headers: {
Authorization: "Token <your_64_char_api_key>",
Accept: "*/*; version=2",
"Content-Type": "application/json",
},
body: JSON.stringify({
client_user: "dlfpgqe5r6yu",
page_domain: "https://example.com",
page_path: "/pricing",
timestamp: "2026-11-10T09:32:46.576Z",
}),
},
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/site-views/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Token <your_64_char_api_key>",
"Accept: */*; version=2",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"client_user" => "dlfpgqe5r6yu",
"page_domain" => "https://example.com",
"page_path" => "/pricing",
"timestamp" => "2026-11-10T09:32:46.576Z",
]),
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
response = requests.post(
"https://<your_app_subdomain>.user.com/api/public/site-views/",
headers={
"Authorization": "Token <your_64_char_api_key>",
"Accept": "*/*; version=2",
},
json={
"client_user": "dlfpgqe5r6yu",
"page_domain": "https://example.com",
"page_path": "/pricing",
"timestamp": "2026-11-10T09:32:46.576Z",
},
)
print(response.json())
Response examples
- 201 Created
- 400 Bad Request
{
"id": 54,
"client_user": "Ypp9DQiEZIPl",
"created_at": "2019-10-07T11:39:25.385368Z",
"domain": "http://mysite.com",
"path": "/my-path"
}
{"page_domain": ["This field is required."]}Response fields
Fields returned in the 201 Created response body.
- id
- ID of the page visit.
- client_user
- A unique identifier (12 random characters) for the user which is given by User automatically.
- created_at
- When the visit was recorded, ISO 8601.
- domain
- Domain of the visited page, with the protocol, for example
https://example.com. - path
- Path of the visited page on that domain, for example
/pricing.
note
Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.