🚀 1. Cài đặt cơ bản
Thêm script tag trực tiếp với data attributes:
<script
src="https://tracking.flow-widget.cxgenie.app/cdn/v2/tracker.umd.js"
data-brand-id="YOUR_BRAND_ID"
data-api-key="YOUR_API_KEY"
data-auto-init="true"
data-enable-widget="true"
data-environment="local"
data-widget-url="http://localhost:8080/script/widget.min.js"
data-debug="false">
</script>
💡 Lưu ý: Tracker sẽ tự động khởi tạo dựa trên các data
attributes khi script được load.
🔧 3. Sử dụng thủ công (Manual)
Khởi tạo tracker:
// Khởi tạo tracker, bạn không cần phải làm bước này nếu đã đã dùng data-auto-init= true ở script
window.Tracker.init(brandId, {
debug: true,
api_url: "https://tracking.api.qc.cxgenie.ai/api",
x_api_key: "your-api-key",
enable_widget: true
});
// Track events
window.Tracker.track("BUTTON_CLICK", {
button: "purchase",
value: 100
});
// Identify user
window.Tracker.identify("user_123", {
name: "John Doe",
email: "john@example.com"
});