Full Answer
The installation has two layers: base code and event code. The base code loads TikTok's tracking library on every page. Event codes fire specific conversion signals on pages where customer actions occur. Both are required for TikTok Ads to optimize campaigns effectively.
The base code is a JavaScript snippet containing your unique Pixel ID. It must load on every page of your site, which means placing it in the site-wide header. For WordPress, the cleanest approach is your theme's header scripts field (found in Appearance then Customize then Additional Scripts on most themes). If your theme lacks this field, the Insert Headers and Footers plugin provides it. Avoid pasting the code directly into header.php — theme updates will overwrite it.
Event codes track specific customer actions. TikTok's standard ecommerce events include ViewContent for product page views, AddToCart when items are added to the cart, InitiateCheckout when the checkout page loads, and CompletePayment on the order confirmation page. Each event accepts parameters: content_id for the product SKU, content_type set to product, value for the price, and currency.
For WooCommerce stores, manual event placement is unnecessarily complex. Plugins that integrate with WooCommerce hooks handle event placement automatically by firing the correct TikTok event at each stage of the purchase funnel. The plugin approach also handles dynamic product data — passing the correct SKU, price, and quantity for each event without custom JavaScript per product page.