API & Webhook
Base URL
https://fraud.digizone.vnPublic Endpoints
Health Check
http
GET /api/v1/healthTracking Click
http
POST /api/v1/click
Content-Type: application/json
{
"tracking_key": "YOUR_TRACKING_KEY",
"ip": "1.2.3.4",
"gclid": "Cj0KCQj...",
"user_agent": "Mozilla/5.0...",
"referrer": "https://google.com",
"page_url": "https://yoursite.com/landing"
}Response:
json
{ "status": "clean", "score": 15, "action": "allow" }| Status | Score | Mô tả |
|---|---|---|
clean | < 40 | Click bình thường |
suspicious | 40-69 | Click nghi ngờ |
fraud | ≥ 70 | Click gian lận → tự động chặn |
Beacon (Behavioral Data)
http
POST /api/v1/click/beacon
Content-Type: application/json
{
"click_id": 12345,
"time_on_page": 45,
"scroll_depth": 80,
"mouse_entropy": 1250
}Response: 204 No Content (async, latency ~1ms)
Conversion Webhook
Gửi dữ liệu chuyển đổi (đơn hàng, lead) để AdsShield biết click nào đã convert — phục vụ phân tích hiệu quả và phân biệt click thật.
Authentication
Mỗi website có Webhook Secret Key riêng. Xem tại: Dashboard → Websites → tên website → API Key.
Endpoint
http
POST /api/v1/webhook/conversion
Authorization: Bearer YOUR_WEBHOOK_SECRET
Content-Type: application/json
{
"gclid": "Cj0KCQj...",
"value": 1500000,
"currency": "VND",
"order_id": "DH2026051001",
"event_name": "purchase"
}Response thành công:
json
{ "success": true, "click_id": 12345, "message": "conversion recorded" }Các trường:
| Trường | Bắt buộc | Mô tả |
|---|---|---|
gclid | ✅ | Google Click ID từ URL |
value | — | Giá trị đơn hàng |
currency | — | Đơn vị tiền tệ (mặc định VND) |
order_id | — | Mã đơn hàng của bạn |
event_name | — | Tên sự kiện (purchase, lead...) |
Lỗi thường gặp:
| Code | Nguyên nhân |
|---|---|
| 401 | Sai hoặc thiếu Authorization header |
| 404 | GCLID không tìm thấy trong hệ thống |
| 409 | GCLID đã có conversion (duplicate) |
Tích hợp với WordPress / WooCommerce
php
// Sau khi đơn hàng được tạo
add_action('woocommerce_checkout_order_created', function($order) {
$gclid = WC()->session->get('gclid');
if (!$gclid) return;
wp_remote_post('https://fraud.digizone.vn/api/v1/webhook/conversion', [
'headers' => [
'Authorization' => 'Bearer YOUR_WEBHOOK_SECRET',
'Content-Type' => 'application/json',
],
'body' => json_encode([
'gclid' => $gclid,
'value' => $order->get_total(),
'currency' => 'VND',
'order_id' => $order->get_id(),
'event_name' => 'purchase',
]),
]);
});Rate Limiting
- Click API: 10 req/giây per IP (burst 50)
- Conversion Webhook: 100 req/phút per website
Plans API (Public)
http
GET /api/v1/plansTrả về danh sách gói cước + branding động cho landing page. Không cần auth.