Getting started
New to SquaredanceGuidesFAQsBrands
Brand Quick StartCampaignsPartnershipsBrand ReportingManaging CreativesBillingPartners
Partner Quick StartTracking & IntegrationsPartner ReportingSubmitting CreativesPayoutsReferralsTechnical Docs
Tracking ChangelogUtilizing Tiktok ads
This tutorial requires knowledge of backend coding languages like PHP and web servers. Support with setting up a server and coding of S2S API endpoint will not be covered by the Squaredance support. We suggest hiring an expert if you are not comfortable proceeding with the this guide on your own.
To incorporate Tiktok ads tracking into SQD, you will first have to create a new pixel on Tiktok.
Creating a new pixel on you TikTok Ads Manager only takes a few simple steps:
1. When you have logged into your TikTok Ads Manager, please click on Assets -> Events on the top menu bar
2. Please click on Manage under Web Events
3. Please name the pixel, and select Events API. Proceed clicking Next.
4. Please select Manually Set UP Events API and click Next
5. Click Go to Settings
6. On the next page you will find your Pixel ID and can generate your access token that can later be used to integrate with our server. Click on the "Generate Access Token" button to create an access token. Share these two with the developer so that they can construct the payload that needs to be sent to the server.
The developer can create and test the events using the "Test Server Events" mode under the "Test Events" tab.
Step 2 - Creating a postback endpoint on your server
Important note!
This step requires knowledge of backend coding languages like PHP and web servers. Support with setting up a server and coding of S2S API endpoint will not be covered by the Squaredance support. We suggest hiring an expert if you are not comfortable proceeding with the this step on your own. Please share the following instructions about creating a postback endpoint with your developer.
- Create a server script that takes the value of ttclid query string parameter and creates a payload that is compatible with the TikTok API and delivers it to the TikTok server.
- Refer to TikTok's documentation on Marketing API for information on Access-Token, API endpoint, and example payload.
- It’s recommended that you use the value of the following query string parameters in your S2S postback script so that it’s compatible with the JS code in step 3.
Parameter | Description |
ttclid | TikTok’s Click ID |
event | Ecommerce Event Type |
Your final application URL with the query string parameters and placeholder values should look like - https://yourdomain.com/tiktok?ttclid=[ttclid here]&event=[event name here]
Step 3 - Add your postback to the Squaredance platform
- Multi-funnel pixel template - Replace
yourdomain.com/tiktok
with your application URL.
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
var events = {
Engagement: "ViewContent",
Lead: "ViewContent",
ViewContent:"ViewContent",
AddToCart:"AddToCart",
InitiateCheckout: "InitiateCheckout",
AddPaymentInfo: "AddPaymentInfo"
};
var event = events["xxeventxx"] || "ViewContent";
var pixel = document.createElement("img");
pixel.src = "https://yourdomain.com/tiktok?ttclid=" + urlParams.get('ttclid') + "&event=" + event;
</script>
- Purchase pixel template - Replace
yourdomain.com/tiktok
with your application URL.
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
var event = 'CompletePayment';
var pixel = document.createElement("img");
pixel.src = "https://yourdomain.com/tiktok?ttclid=" + urlParams.get('ttclid') + "&event=" + event;
</script>
- After replacing the placeholder application URL with your application URL in the multi-funnel pixel and purchase pixel. Go to the Squaredance partners platform and select a campaign. You can click on the add button to add new pixels.
- Add the multi-funnel pixel as shown in the screenshot below and click on save.
- Add the purchase pixel as shown in the screenshot below and click on save.
Now the partners platform will ping your server with the TikTok click ID and event name whenever a new user lands on the funnel.
Step 4 - Create campaigns and ads
- When setting up a new conversion campaign make sure you select a TikTok pixel id and an optimization event as shown in the screenshot below
- Important - When creating ads make sure you use
&ttclid=__CLICKID__
at the end of the ad links. If this parameter is added, TikTok ads will pass the click id to the funnel whenever a new user lands on it. To know more about TikTok’s click id please refer to TikTok's TTCLID Parameter Doc.
FAQs
How do TikTok's e-commerce events compare with the Squaredance events?
TikTok maintains its own set of E-Commerce events in order to track user engagement along a funnel. We've mapped the following TikTok events to corresponding Squaredance events.
TikTok Event | Squaredance Event |
ViewContent | Engagement |
ViewContent | Lead |
ViewContent | ViewContent |
AddToCart | AddToCart |
InitiateCheckout | InitiateCheckout |
AddPaymentInfo | AddPaymentInfo |
CompletePayment | Purchase |
Why is TikTok not passing the click id to the funnel?
If TikTok has enabled the TTCLID for your add account, it will start passing in the URL parameters for new users coming from live ads. If TTCLID is not passing for you, please refer to TTCLID Parameter Doc.
How to fire TikTok's pixel only from traffic originating from TikTok?
Please use the setting in the pixel area of the campaign and select the option to conditionally fire pixel based on sub ID values or values of c1, c2, c3.