Capture ttclid on landing
TikTok appends ttclid to every ad click. You must capture it before the user navigates away.
(function () {
var p = new URLSearchParams(window.location.search);
var ttclid = p.get("ttclid");
if (ttclid) {
document.cookie = "_ttclid=" + ttclid + ";path=/;max-age=" + 60*60*24*30 + ";SameSite=Lax";
}
})();