TikTok by Stape for Client GTM - two ttcsid cookies

Is it correct that TikTok writes two ttcsid cookies (ttscsid and ttcsid_{{pixelcode}}). What’s the reason behind it?

Hi @simon_reu, yes, the TikTok SDK downloaded (https://analytics.tiktok.com/i18n/pixel/events.js) by the template creates these cookies ttcsid and ttcsid_{{Pixel Code}}

As for their purpose, I couldn’t find any TikTok official source.

When inspecting the source code I was able to find that is relates to some sort of session tracking. TikTok probably uses this on the backend to improve the tracking accuracy.

The screenshot below is the data that gets written into the cookies. It contains the timestamp of last reported event, whether the engaged session was reported, number of sessions and session ID.
image

The ttcsid holds something related to page-based session and the ttcsid_{{Pixel Code}} holds the same info, but for a specific pixel code.

The cookie value format seems to be something like this:
{sessionId}.{sessionCount}.{lastEventTS}.{hasReportedES}

You can find some of these data under context.csct, context.csid (from the ttcsid_{{Pixel Code}} cookie) and context.page_csid (from the ttcsid cookie) in the request payload.