Cài đặt trên TikTok Event Manager #
- Đăng nhập vào Trình quản lý sự kiện TikTok của bạn.
- Nhấp vào + để kết nối một nguồn dữ liệu mới.

- Chọn tùy chọn “Web” và nhấp vào “Tiếp theo”.
- Hãy chọn tùy chọn thiết lập thủ công nếu bạn dự định tự cài đặt mã pixel.

- Đối với phương thức kết nối, hãy chọn tùy chọn “Tiktok Pixel + Events API”.

- Hãy đặt tên cho pixel của bạn.

- Hãy chèn mã cơ bản vào trang đích của bạn (bên trong thẻ ).

- Hãy làm theo các bước sau để thiết lập các sự kiện như tải trang và nhấp chuột. Bạn cũng có thể thiết lập các sự kiện này sau khi trang đích của bạn đã sẵn sàng. Tại Bước 7, vui lòng lưu ID Pixel và tạo mã thông báo truy cập để tiến hành các bước cấu hình tiếp theo.

Cài đặt mã trang đích #
- Hãy làm theo mã mẫu của chúng tôi và chỉ cần thay đổi ID pixel của bạn. Vui lòng chèn phần mã pixel TikTok vào thẻ , đồng thời thay thế CVQT4GJC77U89V958HM0 bằng ID pixel của riêng bạn.
JavaScript
<head>
<!-- TikTok Pixel Code Start -->
<script>
!(function (w, d, t) {
w.TiktokAnalyticsObject = t;
var ttq = (w[t] = w[t] || []);
// Define available methods
ttq.methods = [
"page", "track", "identify", "instances", "debug",
"on", "off", "once", "ready", "alias", "group",
"enableCookie", "disableCookie",
"holdConsent", "revokeConsent", "grantConsent",
];
// Defer method calls until SDK loads
ttq.setAndDefer = function (t, e) {
t[e] = function () {
t.push([e].concat(Array.prototype.slice.call(arguments, 0)));
};
};
for (var i = 0; i < ttq.methods.length; i++) {
ttq.setAndDefer(ttq, ttq.methods[i]);
}
// Create pixel instance
ttq.instance = function (t) {
var e = ttq._i[t] || [];
for (var n = 0; n < ttq.methods.length; n++) {
ttq.setAndDefer(e, ttq.methods[n]);
}
return e;
};
// Load the TikTok pixel SDK
ttq.load = function (e, n) {
var r = "https://analytics.tiktok.com/i18n/pixel/events.js";
var o = n && n.partner;
ttq._i = ttq._i || {};
ttq._i[e] = [];
ttq._i[e]._u = r;
ttq._t = ttq._t || {};
ttq._t[e] = +new Date();
ttq._o = ttq._o || {};
ttq._o[e] = n || {};
// Inject script tag
var script = document.createElement("script");
script.type = "text/javascript";
script.async = true;
script.src = r + "?sdkid=" + e + "&lib=" + t;
var firstScript = document.getElementsByTagName("script")[0];
firstScript.parentNode.insertBefore(script, firstScript);
};
// Initialize with pixel ID and fire page view
ttq.load("CVQT4GJC77U89V958HM0");
ttq.page();
})(window, document, "ttq");
</script>
<!-- TikTok Pixel Code End -->
</head>Vui lòng chèn đoạn mã dưới đây vào phần nội dung của trang HTML; bạn có thể chỉnh sửa cho phù hợp nếu cần.
JavaScript
<script>
// Capture URL Parameters
const urlParams = new URLSearchParams(window.location.search);
let ttclid = urlParams.get("ttclid") || "";
let campaign_id = urlParams.get("campaign_id") || "";
let campaign_name = urlParams.get("campaign_name") || "";
let creative_name = urlParams.get("creative_name") || "";
// Function to Handle Download Button Click
function handleDownloadClick() {
let trackingURL =
`https://track.tenjin.com/v0/click/NBoIGJFsXn8oGtlVqtcaL` +
`?tenjin_parameter_1=${ttclid}` +
`&redirect=false`;
let downloadURL = "https://kudoocat.com/puzzlegame.apk";
// Step 1: Send tracking request silently (no page redirection)
fetch(trackingURL, { method: "GET", mode: "no-cors" })
.then(() => {
console.log("Tracking sent successfully.");
})
.catch(() => {
console.log("Tracking request failed.");
});
// Step 2: Directly trigger file download
window.location.href = downloadURL;
}
// Prevent iOS Double-Tap Zoom
let lastTouchEnd = 0;
document.addEventListener(
"touchend",
function (event) {
const now = Date.now();
if (now - lastTouchEnd <= 300) {
event.preventDefault();
}
lastTouchEnd = now;
},
false
);
// Prevent Multi-Touch Gestures
document.addEventListener(
"touchstart",
function (e) {
if (e.touches.length > 1) {
e.preventDefault();
}
},
{ passive: false }
);
</script>Đối với URL theo dõi, vui lòng lấy URL theo dõi của riêng bạn từ Tenjin (tham khảo hướng dẫn thiết lập Tenjin dưới đây).
Cài đặt trên bảng điều khiển Tenjin #
- Thêm kênh TikTok Web-to-App vào bảng điều khiển Tenjin.
- Tạo một liên kết theo dõi trong trang chiến dịch , liên kết theo dõi này cần được tích hợp vào trang đích của bạn:
https://track.tenjin.com/v0/click/NBoIGJFsXn8oGtlVqtcaL?click_id=${ttclid}&redirect=false - Bật tính năng gọi lại cài đặt từ web sang ứng dụng trên TikTok.
