API & Webhook

Base URL

https://fraud.digizone.vn

Public Endpoints

Health Check

http
GET /api/v1/health

Tracking 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" }
StatusScoreMô tả
clean< 40Click bình thường
suspicious40-69Click nghi ngờ
fraud≥ 70Click 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ườngBắt buộcMô tả
gclidGoogle Click ID từ URL
valueGiá trị đơn hàng
currencyĐơn vị tiền tệ (mặc định VND)
order_idMã đơn hàng của bạn
event_nameTên sự kiện (purchase, lead...)

Lỗi thường gặp:

CodeNguyên nhân
401Sai hoặc thiếu Authorization header
404GCLID không tìm thấy trong hệ thống
409GCLID đã 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/plans

Trả về danh sách gói cước + branding động cho landing page. Không cần auth.