Data insert API
Pageview
GET
https://data.thoughtmetric.io/d
Records a page view. Pageviews are what sessions are built from, so they are the foundation of attribution.
Example request
curl -G https://data.thoughtmetric.io/d \
-d id=ID-bcd0aa692ce7e6b2 \
-d uid=8824a9fc-002d-4fb8-bcea-9e60225a88f0 \
-d ht=pageview \
-d v=api \
-d ip=203.0.113.42 \
--data-urlencode dl=https://example-store.com/products/wool-crew \
--data-urlencode rl=https://www.google.com/ \
-d ts=2024-01-31T18:22:04Z
<?php
$baseUrl = "https://data.thoughtmetric.io/d";
$params = [
"id" => "ID-bcd0aa692ce7e6b2",
"uid" => "8824a9fc-002d-4fb8-bcea-9e60225a88f0", // visitor uuid from your cookie
"ht" => "pageview",
"v" => "api",
"ip" => "203.0.113.42", // the customer ip, not your server ip
"dl" => "https://example-store.com/products/wool-crew",
"rl" => "https://www.google.com/",
"ts" => time(),
];
$url = $baseUrl . "?" . http_build_query($params);
file_get_contents($url);
const params = new URLSearchParams({
id: "ID-bcd0aa692ce7e6b2",
uid: "8824a9fc-002d-4fb8-bcea-9e60225a88f0", // visitor uuid from your cookie
ht: "pageview",
v: "api",
ip: "203.0.113.42",
dl: "https://example-store.com/products/wool-crew",
rl: "https://www.google.com/",
ts: new Date().toISOString(),
});
await fetch(`https://data.thoughtmetric.io/d?${params}`);
Query parameters
| id string, required | Your Project ID. |
| uid string, required | UUID identifying the visitor. Reuse it across all of their events. |
| ht string, required | Always pageview for this call. |
| v string | Always api for this call. |
| ip string | Visitor's IP address. Omit and we use the requesting IP, which server-side is your server. |
| dl string | Full URL of the page viewed, query string included. UTM parameters are read from here. |
| rl string | Referring URL, used to work out the channel. |
| dt string | Page title. |
| ua string | Visitor's user agent. |
| ts string | When the view happened. ISO 8601 or Unix seconds. |
Notes
- Attribution comes almost entirely from
dlandrl. Send the landing URL with its full query string, or paid traffic will not be recognised. - The response is the pixel asset and always a 200, so it cannot confirm the hit was recorded.