Server-side Events
Send tracking events directly from your server.
Supported events
These events can be sent from the backend:
| Event | Use case |
|---|---|
order | Track completed orders |
order_cancel | Cancel an order |
subscribe | Subscribe/unsubscribe users |
Order event
No duplicates
Orders are automatically deduplicated based on order_id. If the same order was already sent (e.g., from frontend tracking), the duplicate will be ignored. You can safely send orders from both frontend and backend without worrying about duplicates.
- cURL
- Python
- PHP
curl -X POST https://api.edrone.me/trace \
-d "app_id=YOUR_APP_ID" \
-d "sender_type=server" \
-d "action_type=order" \
-d "email=john@example.com" \
-d "first_name=John" \
-d "last_name=Doe" \
-d "order_id=ORD-12345" \
-d "country=US" \
-d "city=New York" \
-d "base_currency=USD" \
-d "order_currency=USD" \
-d "base_payment_value=99.99" \
-d "order_payment_value=99.99" \
-d "product_ids=123" \
-d "product_titles=Product Name" \
-d "product_images=https://store.com/img.jpg" \
-d "product_urls=https://store.com/product" \
-d "product_counts=1" \
-d "product_category_ids=1~2" \
-d "product_category_names=Category~Subcategory"
import requests
response = requests.post('https://api.edrone.me/trace', data={
'app_id': 'YOUR_APP_ID',
'sender_type': 'server',
'action_type': 'order',
'email': 'john@example.com',
'first_name': 'John',
'last_name': 'Doe',
'order_id': 'ORD-12345',
'country': 'US',
'city': 'New York',
'base_currency': 'USD',
'order_currency': 'USD',
'base_payment_value': '99.99',
'order_payment_value': '99.99',
'product_ids': '123',
'product_titles': 'Product Name',
'product_images': 'https://store.com/img.jpg',
'product_urls': 'https://store.com/product',
'product_counts': '1',
'product_category_ids': '1~2',
'product_category_names': 'Category~Subcategory'
})
<?php
function sendOrder($order, $products) {
$data = http_build_query([
'app_id' => 'YOUR_APP_ID',
'sender_type' => 'server',
'action_type' => 'order',
'email' => $order->email,
'first_name' => $order->firstName,
'last_name' => $order->lastName,
'order_id' => $order->id,
'country' => $order->country,
'city' => $order->city,
'base_currency' => 'USD',
'order_currency' => $order->currency,
'base_payment_value' => $order->total,
'order_payment_value' => $order->total,
'product_ids' => implode('|', array_column($products, 'id')),
'product_titles' => implode('|', array_column($products, 'title')),
'product_images' => implode('|', array_column($products, 'image')),
'product_urls' => implode('|', array_column($products, 'url')),
'product_counts' => implode('|', array_column($products, 'quantity')),
'product_category_ids' => implode('|', array_column($products, 'categoryIds')),
'product_category_names' => implode('|', array_column($products, 'categoryNames'))
]);
$ch = curl_init('https://api.edrone.me/trace');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
Order statuses
You can optionally include order_status field to specify the current state of the order:
| Status | Description |
|---|---|
placed | Order placed, awaiting payment |
paid | Payment confirmed |
delivered | Order delivered |
cancelled | Order cancelled |
curl -X POST https://api.edrone.me/trace \
-d "app_id=YOUR_APP_ID" \
-d "sender_type=server" \
-d "action_type=order" \
-d "order_id=ORD-12345" \
-d "order_status=paid" \
# ... other fields
Order cancel event
Cancel a previously submitted order:
- cURL
- Python
- PHP
curl -X POST https://api.edrone.me/trace \
-d "app_id=YOUR_APP_ID" \
-d "sender_type=server" \
-d "action_type=order_cancel" \
-d "order_id=ORD-12345"
import requests
response = requests.post('https://api.edrone.me/trace', data={
'app_id': 'YOUR_APP_ID',
'sender_type': 'server',
'action_type': 'order_cancel',
'order_id': 'ORD-12345'
})
<?php
$data = http_build_query([
'app_id' => 'YOUR_APP_ID',
'sender_type' => 'server',
'action_type' => 'order_cancel',
'order_id' => 'ORD-12345'
]);
$ch = curl_init('https://api.edrone.me/trace');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
Response
Successful requests return HTTP 200 with headers including x-edrone-event-id.