Events Reference
AxiTrace supports a comprehensive set of events for tracking user behavior, e-commerce activities, and business metrics. Learn about each event type and how to implement them.
Timing & Deduplication
Two things surprise almost every new integration: events don't appear immediately, and the API's duplicate-request protection is narrower than most GA4-style APIs. Both are intentional, not bugs.
A 200 OK from /v1/transaction, /v1/product/addToCart, or any
other conversion-type event means the event was queued, not yet processed. The
event worker holds conversion events for 10 seconds before forwarding them to
Facebook CAPI / TikTok Events API. This gives the JavaScript SDK time to write fbp/
fbc onto the visitor's profile first, so server-side conversion events get full match
quality instead of racing ahead of the browser pixel. Profile-enrichment events
(page.view, profile.update) are processed immediately - they're what
populate the profile the delayed events read from.
The event worker rejects any event whose queue age exceeds 1 hour (3600 seconds) -
it is logged as stale and dropped rather than forwarded to Facebook/TikTok with an outdated
timestamp. This matters most for retries and backfills: if you replay events from a queue, dead
letter store, or CSV export that is more than an hour old, those events will silently never reach
your ad platforms even though the ingestion API accepted them with 200 OK at replay
time.
eventSalt - Most Other Events Do Not
Deduplication is keyed on eventSalt. If the same salt is submitted again inside the
window, the second request is accepted (200 OK) but dropped instead of being
processed twice. This is what makes a retry safe.
Purchases get a 30-day window, on both the SDK's /track endpoint and
the server-side /v1/transaction endpoint. The window is long because a duplicate
purchase is rarely an instant double-fire: it is a buyer reopening the order-confirmation page the
next morning, a tag firing again from the browser's back-forward cache, a redelivered webhook, or
an outbox drained after an outage. Every other event type gets 5 minutes, which
covers a retried beacon or a double-fired tag while still treating a page reloaded an hour later
as the genuine second visit it is.
What still does not deduplicate: the non-purchase /v1/* endpoints
(/v1/product/addToCart, /v1/page/view and the rest). Send one of those
twice and you get two events. Build idempotency into your own integration for those - for example,
only call the API once you have durably recorded that you attempted it. Deduplication state is
cached rather than kept forever, so treat it as a safety net for retries rather than a substitute
for a unique constraint in your own database.
Event Categories
All Available Events
Every event below can be sent from either side. The Event column is the
name you pass to the browser SDK - Axitrace._instance.track('name', { ... }) - and
the Endpoint column is the REST route your backend posts to. Both write the same row and
forward to the same destinations, so pick one side per event: two sources count the
same action twice.
Two exceptions worth knowing before you choose. Purchases belong on your server, always - only your backend knows an order was actually paid, and a Secret Key must never reach a browser. The checkout steps are better on your server for the same reason, though the browser path is there for shops with no backend to send from. If your shop already publishes a GA4 ecommerce dataLayer, the SDK can translate it and you call nothing at all: see the Google Tag Manager guide. Full reasoning per event: Sending events from your server.
| Event | Endpoint | Description |
|---|---|---|
page.view |
POST /v1/page/view |
Track when a user views a page |
product.view |
POST /v1/product/view |
Track when a user views a product |
product.addToCart |
POST /v1/product/addToCart |
Track when a user adds a product to cart |
remove_from_cart |
POST /v1/cart/remove |
Track when a user removes an item from cart |
view_item_list |
POST /v1/catalog/view_list |
Track when a user views a product list/category |
select_item |
POST /v1/catalog/select_item |
Track when a user selects an item from a list |
begin_checkout |
POST /v1/checkout/begin |
Track when a user starts checkout |
add_payment_info |
POST /v1/checkout/add_payment_info |
Track when a user adds payment information |
add_shipping_info |
POST /v1/checkout/add_shipping_info |
Track when a user adds shipping information |
transaction.charge |
POST /v1/transaction |
Track a completed purchase/transaction |
transaction.refund |
POST /v1/refund |
Report a refund or cancellation (server-side, Secret Key only); reduces profit, never revenue |
search |
POST /v1/search |
Track search queries |
form.submit |
POST /v1/form/submit |
Track form submissions |
subscribe |
POST /v1/subscribe |
Track newsletter/mailing list subscriptions |
start_trial |
POST /v1/start_trial |
Track when a user starts a trial |
custom |
POST /v1/custom-events |
Track YOUR OWN merchant-defined event names (pre-registration required) |
Events the SDK sends for you
These reach /track as well, but there is no REST endpoint and nothing for you to call:
the JavaScript SDK emits them on its own. They are listed because they are reserved names - a custom
event cannot be called any of them - and because you will see them in your error log.
| Event | Sent by | Description |
|---|---|---|
profile.update / identify |
SDK, and your own identify() call |
Attaches an email or the pixel cookies (fbp, fbc) to the
visitor's profile, so the conversion events that follow have something to match on. |
error / js.error / js.unhandledrejection |
SDK, automatically | A JavaScript error on your storefront. Consumed and dropped - it is diagnostics, never forwarded to an ad platform. |
engagement |
SDK, automatically | One beacon per page view carrying scroll and interaction signals. Feeds fraud detection only, and never influences what you report or what an ad platform sees. |
internal.lost |
SDK, automatically | Telemetry about the SDK itself: its offline queue overflowed and dropped the oldest
entries. Nothing is stored; it is answered 200 and logged for us. |
Common Fields
All events share these common fields for user identification:
| Field | Type | Description |
|---|---|---|
client_id |
string | Your custom user identifier |
user_id |
string | Authenticated user ID |
session_id |
string | Session identifier |
Server-side events MUST include user identifiers that match those generated by the JavaScript SDK. Without matching identifiers, AxiTrace cannot properly link events to build complete user profiles. Events without identifiers will be recorded but won't be associated with any user journey.
User Identification (Server-Side Integration)
When sending events from your server, you must pass the same user identifiers that the JavaScript SDK uses. This ensures all events (client-side and server-side) are properly associated with the same user profile.
How the JavaScript SDK Manages Identity
The AxiTrace JavaScript SDK automatically generates and stores three types of identifiers:
| Identifier | Cookie Name | Purpose | Lifetime |
|---|---|---|---|
| Visitor ID | vt_vid |
Persistent anonymous visitor identifier (UUID) | 1 year (persistent) |
| Session ID | vt_sid |
Current browsing session identifier (UUID) | 30 minutes of inactivity |
| User ID | vt_uid |
Your authenticated user ID (set via identify()) |
1 year (persistent) |
Reading SDK Identifiers
To send server-side events, you need to read the SDK-generated cookies and pass them to your backend:
// Read the SDK's first-party identity cookies (e.g. for a form submission)
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
return null;
}
const visitorId = getCookie('vt_vid');
const sessionId = getCookie('vt_sid');
const userId = getCookie('vt_uid');
// Pass these to your server (e.g., in hidden form fields or fetch request)
fetch('/api/track-event', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
event: 'purchase',
visitorId: visitorId,
sessionId: sessionId,
userId: userId,
// ... other event data
})
});
<?php
// Read AxiTrace cookies from the request
$visitorId = $_COOKIE['vt_vid'] ?? null;
$sessionId = $_COOKIE['vt_sid'] ?? null;
$userId = $_COOKIE['vt_uid'] ?? null;
// Now use these when sending server-side events
$eventData = [
'client' => [
'customId' => $userId ?? $visitorId, // User ID takes priority
'uuid' => $visitorId, // Always include visitor ID
],
'sessionId' => $sessionId,
// ... other event data
];
// Example: Send a transaction event
$ch = curl_init('https://stat.axitrace.com/v1/transaction');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Basic ' . base64_encode('sk_live_YOUR_SECRET_KEY:'),
],
CURLOPT_POSTFIELDS => json_encode([
'client' => [
'customId' => $userId ?? $visitorId,
'uuid' => $visitorId,
],
'sessionId' => $sessionId,
'transactionId' => 'order-12345',
'revenue' => 99.99,
'currency' => 'USD',
// ... more fields
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
from flask import request # Example using Flask
# Read AxiTrace cookies from the incoming request
visitor_id = request.cookies.get('vt_vid')
session_id = request.cookies.get('vt_sid')
user_id = request.cookies.get('vt_uid')
# Send server-side event with matching identifiers
response = requests.post(
'https://stat.axitrace.com/v1/transaction',
auth=('sk_live_YOUR_SECRET_KEY', ''),
json={
'client': {
'customId': user_id or visitor_id, # User ID takes priority
'uuid': visitor_id, # Always include visitor ID
},
'sessionId': session_id,
'transactionId': 'order-12345',
'revenue': 99.99,
'currency': 'USD',
# ... more fields
}
)
# Django example
from django.http import JsonResponse
def track_purchase(request):
visitor_id = request.COOKIES.get('vt_vid')
session_id = request.COOKIES.get('vt_sid')
user_id = request.COOKIES.get('vt_uid')
# Use these IDs when sending events to AxiTrace
# ...
The client Object Structure
When sending server-side events, include the client object with matching identifiers:
{
"client": {
"customId": "user-123-or-visitor-uuid",
"uuid": "visitor-uuid-from-vt_vid-cookie"
},
"sessionId": "session-uuid-from-vt_sid-cookie",
... other event fields ...
}
| Field | Source | Required | Description |
|---|---|---|---|
client.customId |
vt_uid or vt_vid |
Recommended | Use vt_uid (authenticated user ID) if available, otherwise vt_vid (visitor ID) |
client.uuid |
vt_vid |
Recommended | Always the visitor ID from vt_vid cookie |
sessionId |
vt_sid |
Optional | Current session ID for session-based analytics |
Identifying Authenticated Users
When a user logs in, call Axitrace._instance.identify() to associate the anonymous visitor with their account:
// Call this after user logs in
Axitrace._instance.identify('user-123');
// This sets the vt_uid cookie, which your server can then read
// All subsequent events (client and server-side) will be linked to this user
AxiTrace automatically stitches together anonymous visitor activity with authenticated user profiles.
When you call identify(), all previous events from that vt_vid (visitor ID)
are retroactively associated with the user account. This gives you a complete view of the user journey
from first visit through conversion.
Complete Server-Side Integration Example
Here's a complete example of tracking a purchase on your server while maintaining identity consistency:
<?php
class AxiTraceClient
{
private string $secretKey;
private string $endpoint = 'https://stat.axitrace.com';
public function __construct(string $secretKey)
{
$this->secretKey = $secretKey;
}
/**
* Get user identifiers from AxiTrace cookies
*/
public function getIdentifiersFromCookies(): array
{
return [
'visitorId' => $_COOKIE['vt_vid'] ?? null,
'sessionId' => $_COOKIE['vt_sid'] ?? null,
'userId' => $_COOKIE['vt_uid'] ?? null,
];
}
/**
* Build the client object for API requests
*/
public function buildClientObject(?array $identifiers = null): array
{
$ids = $identifiers ?? $this->getIdentifiersFromCookies();
return [
'customId' => $ids['userId'] ?? $ids['visitorId'],
'uuid' => $ids['visitorId'],
];
}
/**
* Track a transaction/purchase
*/
public function trackTransaction(array $data): array
{
$ids = $this->getIdentifiersFromCookies();
$payload = array_merge([
'client' => $this->buildClientObject($ids),
'sessionId' => $ids['sessionId'],
], $data);
return $this->sendEvent('/v1/transaction', $payload);
}
private function sendEvent(string $path, array $data): array
{
$ch = curl_init($this->endpoint . $path);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Basic ' . base64_encode($this->secretKey . ':'),
],
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return [
'success' => $httpCode === 200,
'response' => json_decode($response, true),
];
}
}
// Usage in your checkout controller:
$axiTrace = new AxiTraceClient('sk_live_YOUR_SECRET_KEY');
$result = $axiTrace->trackTransaction([
'transactionId' => $order->getId(),
'revenue' => $order->getTotal(),
'currency' => 'USD',
'products' => array_map(fn($item) => [
'productId' => $item->getProductId(),
'name' => $item->getName(),
'price' => $item->getPrice(),
'quantity' => $item->getQuantity(),
], $order->getItems()),
]);
const axios = require('axios');
class AxiTraceClient {
constructor(secretKey) {
this.secretKey = secretKey;
this.endpoint = 'https://stat.axitrace.com';
}
/**
* Extract AxiTrace identifiers from request cookies
*/
getIdentifiersFromRequest(req) {
return {
visitorId: req.cookies?.vt_vid || null,
sessionId: req.cookies?.vt_sid || null,
userId: req.cookies?.vt_uid || null,
};
}
/**
* Build the client object for API requests
*/
buildClientObject(identifiers) {
return {
customId: identifiers.userId || identifiers.visitorId,
uuid: identifiers.visitorId,
};
}
/**
* Track a transaction/purchase
*/
async trackTransaction(req, data) {
const ids = this.getIdentifiersFromRequest(req);
const payload = {
client: this.buildClientObject(ids),
sessionId: ids.sessionId,
...data,
};
return this.sendEvent('/v1/transaction', payload);
}
async sendEvent(path, data) {
try {
const response = await axios.post(
`${this.endpoint}${path}`,
data,
{
auth: {
username: this.secretKey,
password: '',
},
headers: {
'Content-Type': 'application/json',
},
}
);
return { success: true, response: response.data };
} catch (error) {
return { success: false, error: error.message };
}
}
}
// Express.js usage example:
const cookieParser = require('cookie-parser');
const app = express();
app.use(cookieParser());
const axiTrace = new AxiTraceClient('sk_live_YOUR_SECRET_KEY');
app.post('/checkout/complete', async (req, res) => {
const order = req.body.order;
// Track the transaction with matching user identifiers
await axiTrace.trackTransaction(req, {
transactionId: order.id,
revenue: order.total,
currency: 'USD',
products: order.items.map(item => ({
productId: item.productId,
name: item.name,
price: item.price,
quantity: item.quantity,
})),
});
res.json({ success: true });
});
import requests
from typing import Optional, Dict, Any
class AxiTraceClient:
def __init__(self, secret_key: str):
self.secret_key = secret_key
self.endpoint = 'https://stat.axitrace.com'
def get_identifiers_from_request(self, request) -> Dict[str, Optional[str]]:
"""Extract AxiTrace identifiers from request cookies"""
return {
'visitor_id': request.cookies.get('vt_vid'),
'session_id': request.cookies.get('vt_sid'),
'user_id': request.cookies.get('vt_uid'),
}
def build_client_object(self, identifiers: Dict) -> Dict[str, str]:
"""Build the client object for API requests"""
return {
'customId': identifiers.get('user_id') or identifiers.get('visitor_id'),
'uuid': identifiers.get('visitor_id'),
}
def track_transaction(self, request, data: Dict[str, Any]) -> Dict:
"""Track a transaction/purchase"""
ids = self.get_identifiers_from_request(request)
payload = {
'client': self.build_client_object(ids),
'sessionId': ids.get('session_id'),
**data,
}
return self._send_event('/v1/transaction', payload)
def _send_event(self, path: str, data: Dict) -> Dict:
try:
response = requests.post(
f'{self.endpoint}{path}',
json=data,
auth=(self.secret_key, ''),
headers={'Content-Type': 'application/json'},
)
return {'success': response.ok, 'response': response.json()}
except Exception as e:
return {'success': False, 'error': str(e)}
# Django usage example:
from django.views.decorators.http import require_POST
from django.http import JsonResponse
axi_trace = AxiTraceClient('sk_live_YOUR_SECRET_KEY')
@require_POST
def checkout_complete(request):
order = Order.objects.get(id=request.POST['order_id'])
# Track the transaction with matching user identifiers
axi_trace.track_transaction(request, {
'transactionId': str(order.id),
'revenue': float(order.total),
'currency': 'USD',
'products': [{
'productId': str(item.product_id),
'name': item.name,
'price': float(item.price),
'quantity': item.quantity,
} for item in order.items.all()],
})
return JsonResponse({'success': True})
Never generate random UUIDs for server-side events. Always read the existing cookies
set by the JavaScript SDK. If cookies aren't available (e.g., server-to-server webhooks),
use your own consistent user identifier (like database user ID) and pass it via client.customId.
Tracking Parameters
AxiTrace automatically extracts and preserves marketing attribution parameters:
UTM Parameters
utm_source- Traffic source (e.g., google, facebook)utm_medium- Marketing medium (e.g., cpc, email)utm_campaign- Campaign nameutm_term- Search keywordsutm_content- Content variant
Platform Click IDs
| Platform | Parameter |
|---|---|
| Facebook/Meta | fbclid, fbp, fbc |
| Google Ads | gclid, gbraid, wbraid |
| TikTok | ttclid |
| Microsoft/Bing | msclkid |
| Twitter/X | twclid |
epik |
|
li_fat_id |
|
| Snapchat | sccid |
rdt_cid |
Sending Events
Via JavaScript SDK
// Track any event using the SDK
Axitrace._instance.track('event_name', {
// Event-specific parameters
param1: 'value1',
param2: 'value2'
});
Via HTTP API
curl -X POST https://stat.axitrace.com/v1/{endpoint} \
-u "sk_live_YOUR_SECRET_KEY:" \
-H "Content-Type: application/json" \
-H "User-Agent: MyApp/1.0" \
-d '{
"client_id": "user-123",
... event parameters ...
}'
Response Format
All successful event submissions return:
{
"success": true,
"eventId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"action": "event_name"
}