Category View
Track when users browse category pages.
When to use
Add this event to all category/listing pages.
Implementation
- JavaScript
- cURL
- Python
- PHP
<script type="text/javascript">
window._edrone = window._edrone || {};
_edrone.action_type = 'category_view';
_edrone.product_category_ids = '1~2~3';
_edrone.product_category_names = encodeURIComponent('Shoes~Sneakers~Nike');
</script>
curl -X POST https://api.edrone.me/trace \
-d "app_id=YOUR_APP_ID" \
-d "action_type=category_view" \
-d "product_category_ids=1~2~3" \
-d "product_category_names=Shoes~Sneakers~Nike" \
-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': 'category_view',
'product_category_ids': '1~2~3',
'product_category_names': quote('Shoes~Sneakers~Nike'),
'sender_type': 'server'
})
<?php
$data = http_build_query([
'app_id' => 'YOUR_APP_ID',
'action_type' => 'category_view',
'product_category_ids' => '1~2~3',
'product_category_names' => 'Shoes~Sneakers~Nike',
'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
| Field | Description | Example |
|---|---|---|
action_type | Event type | category_view |
product_category_ids | Category IDs (~ separated) | 1~2~3 |
product_category_names | Category names (~ separated) | Shoes~Sneakers~Nike |
Category hierarchy
The category path should go from parent to child:
// Viewing: Home > Clothing > Women > Dresses
_edrone.product_category_ids = '1~5~12~45';
_edrone.product_category_names = 'Home~Clothing~Women~Dresses';