Contents
Record a Hit - Plugixa Image Map
POST /plugixa-image-map/v1/stats/hit
Add views, tooltip opens and clicks to a published map’s statistics. This is the call the map’s visitor script sends.
Public: no authentication. Limited to 20 requests a minute from one IP address. Needs Plugixa Image Map Pro: on the free build this route does not exist and answers 404.
Request
POST https://your-site.example/wp-json/plugixa-image-map/v1/stats/hit
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
map |
integer |
Yes | A published map. |
v |
integer |
No | Views to add, 0 to 20. |
o |
object |
No | Tooltip opens to add, keyed by hotspot id. |
c |
object |
No | Clicks to add, keyed by hotspot id. |
Each count is capped at 20 and each of o and c at 200 hotspots. Ids that are not hotspots of the map are ignored. Counts go to today’s date (UTC).
{
"map": 12,
"v": 1,
"o": {
"o_3f9a1c2e": 2
},
"c": {
"o_3f9a1c2e": 1
}
}
Responses
204 No Content. The counts were added.
The response has no body, not even the usual envelope.
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_image_map_no_map |
map is missing, not a map, in the trash or not published. |
429 |
plugixa_image_map_rate_limited |
More than 20 requests in a minute from this address. The limit is counted before map is checked. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-image-map/v1/stats/hit" \
-H "Content-Type: application/json" \
-d '{"map":12,"v":1,"o":{"o_3f9a1c2e":2},"c":{"o_3f9a1c2e":1}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-image-map/v1/stats/hit');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'map' => 12,
'v' => 1,
'o' => [
'o_3f9a1c2e' => 2,
],
'c' => [
'o_3f9a1c2e' => 1,
],
]),
]);
curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE); // 204 on success
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-image-map/v1/stats/hit', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
map: 12,
v: 1,
o: {
o_3f9a1c2e: 2,
},
c: {
o_3f9a1c2e: 1,
},
}),
});
console.log(response.status); // 204 on success
Quick Links
Share