Order
Track completed orders. This is essential for revenue tracking, post-purchase campaigns, and customer segmentation.
When to use
Add this event to your thank you / order confirmation page.
Implementation
- JavaScript
- cURL
- Python
- PHP
<script type="text/javascript">
window._edrone = window._edrone || {};
_edrone.action_type = 'order';
// Customer info
_edrone.email = 'john.doe@example.com';
_edrone.first_name = 'John';
_edrone.last_name = 'Doe';
_edrone.user_id = 'CUST-12345';
_edrone.subscriber_status = '1';
// Order info
_edrone.order_id = 'ORD-98765';
_edrone.country = 'US';
_edrone.city = 'New York';
_edrone.base_currency = 'USD';
_edrone.order_currency = 'USD';
_edrone.base_payment_value = '149.99';
_edrone.order_payment_value = '149.99';
// Products (use | to separate multiple products)
_edrone.product_ids = '12345|67890';
_edrone.product_skus = 'SKU-001|SKU-002';
_edrone.product_titles = encodeURIComponent('Nike Air Max 90|Adidas Ultraboost');
_edrone.product_images = encodeURIComponent('https://store.com/img1.jpg|https://store.com/img2.jpg');
_edrone.product_urls = encodeURIComponent('https://store.com/p/1|https://store.com/p/2');
_edrone.product_counts = '1|2';
_edrone.product_category_ids = '1~2~3|1~2~4';
_edrone.product_category_names = encodeURIComponent('Shoes~Sneakers~Nike|Shoes~Sneakers~Adidas');
</script>
curl -X POST https://api.edrone.me/trace \
-d "app_id=YOUR_APP_ID" \
-d "action_type=order" \
-d "email=john.doe@example.com" \
-d "first_name=John" \
-d "last_name=Doe" \
-d "user_id=CUST-12345" \
-d "subscriber_status=1" \
-d "order_id=ORD-98765" \
-d "country=US" \
-d "city=New York" \
-d "base_currency=USD" \
-d "order_currency=USD" \
-d "base_payment_value=149.99" \
-d "order_payment_value=149.99" \
-d "product_ids=12345|67890" \
-d "product_titles=Nike%20Air%20Max%2090|Adidas%20Ultraboost" \
-d "product_images=https%3A%2F%2Fstore.com%2Fimg1.jpg|https%3A%2F%2Fstore.com%2Fimg2.jpg" \
-d "product_urls=https%3A%2F%2Fstore.com%2Fp%2F1|https%3A%2F%2Fstore.com%2Fp%2F2" \
-d "product_counts=1|2" \
-d "product_category_ids=1~2~3|1~2~4" \
-d "product_category_names=Shoes~Sneakers~Nike|Shoes~Sneakers~Adidas" \
-d "sender_type=server"
import requests
from urllib.parse import quote
response = requests.post('https://api.edrone.me/trace', data={
'app_id': 'YOUR_APP_ID',
'action_type': 'order',
'email': 'john.doe@example.com',
'first_name': 'John',
'last_name': 'Doe',
'user_id': 'CUST-12345',
'subscriber_status': '1',
'order_id': 'ORD-98765',
'country': 'US',
'city': 'New York',
'base_currency': 'USD',
'order_currency': 'USD',
'base_payment_value': '149.99',
'order_payment_value': '149.99',
'product_ids': '12345|67890',
'product_titles': quote('Nike Air Max 90') + '|' + quote('Adidas Ultraboost'),
'product_images': quote('https://store.com/img1.jpg') + '|' + quote('https://store.com/img2.jpg'),
'product_urls': quote('https://store.com/p/1') + '|' + quote('https://store.com/p/2'),
'product_counts': '1|2',
'product_category_ids': '1~2~3|1~2~4',
'product_category_names': quote('Shoes~Sneakers~Nike') + '|' + quote('Shoes~Sneakers~Adidas'),
'sender_type': 'server'
})
<?php
$data = http_build_query([
'app_id' => 'YOUR_APP_ID',
'action_type' => 'order',
'email' => 'john.doe@example.com',
'first_name' => 'John',
'last_name' => 'Doe',
'user_id' => 'CUST-12345',
'subscriber_status' => '1',
'order_id' => 'ORD-98765',
'country' => 'US',
'city' => 'New York',
'base_currency' => 'USD',
'order_currency' => 'USD',
'base_payment_value' => '149.99',
'order_payment_value' => '149.99',
'product_ids' => '12345|67890',
'product_titles' => 'Nike Air Max 90|Adidas Ultraboost',
'product_images' => 'https://store.com/img1.jpg|https://store.com/img2.jpg',
'product_urls' => 'https://store.com/p/1|https://store.com/p/2',
'product_counts' => '1|2',
'product_category_ids' => '1~2~3|1~2~4',
'product_category_names' => 'Shoes~Sneakers~Nike|Shoes~Sneakers~Adidas',
'sender_type' => 'server'
]);
$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);
Required fields
Customer info
| Field | Description | Example |
|---|---|---|
email | Customer email | john@example.com |
first_name | Customer first name | John |
Order info
| Field | Description | Example |
|---|---|---|
order_id | Unique order ID | ORD-98765 |
country | Customer country | US |
city | Customer city | New York |
base_currency | Your store's currency | USD |
order_currency | Order currency | USD |
base_payment_value | Order value in base currency | 149.99 |
order_payment_value | Order value in order currency | 149.99 |
Product info
| Field | Description |
|---|---|
product_ids | Product IDs (| separated) |
product_titles | Product names (| separated) |
product_images | Image URLs (| separated) |
product_urls | Product URLs (| separated) |
product_counts | Quantities (| separated) |
product_category_ids | Category IDs (products: |, categories: ~) |
product_category_names | Category names (products: |, categories: ~) |
Multiple products separator
Use | (pipe) to separate data for multiple products:
// 2 products: Nike (qty: 1) and Adidas (qty: 2)
_edrone.product_ids = '12345|67890';
_edrone.product_counts = '1|2';
_edrone.product_titles = 'Nike Air Max|Adidas Ultraboost';
Order of values
Keep the same order across all product fields. The first value in each field relates to the first product.