How to install properly tik tok pixel manually?

Topic summary

A Bulgarian Shopify store owner needs to manually install TikTok pixel tracking because the official TikTok app is unavailable in their country.

Current Progress:

  • Successfully installed the base pixel code in the <head> section
  • Cannot use TikTok’s Event Builder Tool because Shopify’s order confirmation page uses a Shopify-hosted URL instead of their custom domain

Challenge:
Must manually implement event tracking codes for:

  • ViewContent
  • AddToCart
  • InitiateCheckout
  • PlaceAnOrder

Each event requires:

  • Customer identification data (email, phone, external_id) hashed with SHA-256
  • Product details (content_id, content_type, content_name)
  • Transaction values (value, currency in ISO 4217 format)

Status: The user has the code snippets from TikTok but appears to be seeking guidance on proper implementation, particularly around handling the order confirmation tracking limitation and correctly placing the event codes throughout their Shopify theme.

Summarized with AI on November 14. AI used: claude-sonnet-4-5-20250929.

Hello everybody! Recently we started advertising on tik tok and we had to create a pixel such as facebook pixel. Because the official tik tok app is not available for our country [ Bulgaria ] we had to install it manually.

So I set up the base code in the section. This was the easy part.
Then we have 2 options to use the TikTok Event Builder Tool:
Which is not an option because our order conformation is not on our website link for some reason for example it’s not https:/sitename.com/order-successfull - it is a shopify link and because of that we cannot track purchases.

Our second option is to instal every event manually. So tik tok says :
Add events and parameters to your website.
Copy and paste this code to every page you want to measure actions people take.

And the code :
// add this before event code to all pages where PII data postback is expected and appropriate
ttq.identify({
“email”: “<hashed_email_address>”, // string. The email of the customer if available. It must be hashed with SHA-256 on the client side.
“phone_number”: “<hashed_phone_number>”, // string. The phone number of the customer if available. It must be hashed with SHA-256 on the client side.
“external_id”: “<hashed_external_id>” // string. Any unique identifier, such as loyalty membership IDs, user IDs, and external cookie IDs.It must be hashed with SHA-256 on the client side.
});

ttq.track(‘ViewContent’, {
“contents”: [
{
“content_id”: “<content_identifier>”, // string. ID of the product. Example: “1077218”.
“content_type”: “<content_type>”, // string. Either product or product_group.
“content_name”: “<content_name>” // string. The name of the page or product. Example: “shirt”.
}
],
“value”: “<content_value>”, // number. Value of the order or items sold. Example: 100.
“currency”: “<content_currency>” // string. The 4217 currency code. Example: “USD”.
});

ttq.track(‘AddToWishlist’, {
“contents”: [
{
“content_id”: “<content_identifier>”, // string. ID of the product. Example: “1077218”.
“content_type”: “<content_type>”, // string. Either product or product_group.
“content_name”: “<content_name>” // string. The name of the page or product. Example: “shirt”.
}
],
“value”: “<content_value>”, // number. Value of the order or items sold. Example: 100.
“currency”: “<content_currency>” // string. The 4217 currency code. Example: “USD”.
});

ttq.track(‘Search’, {
“contents”: [
{
“content_id”: “<content_identifier>”, // string. ID of the product. Example: “1077218”.
“content_type”: “<content_type>”, // string. Either product or product_group.
“content_name”: “<content_name>” // string. The name of the page or product. Example: “shirt”.
}
],
“value”: “<content_value>”, // number. Value of the order or items sold. Example: 100.
“currency”: “<content_currency>”, // string. The 4217 currency code. Example: “USD”.
“search_string”: “<search_keywords>” // string. The word or phrase used to search. Example: “SAVE10COUPON”.
});

ttq.track(‘AddPaymentInfo’, {
“contents”: [
{
“content_id”: “<content_identifier>”, // string. ID of the product. Example: “1077218”.
“content_type”: “<content_type>”, // string. Either product or product_group.
“content_name”: “<content_name>” // string. The name of the page or product. Example: “shirt”.
}
],
“value”: “<content_value>”, // number. Value of the order or items sold. Example: 100.
“currency”: “<content_currency>” // string. The 4217 currency code. Example: “USD”.
});

ttq.track(‘AddToCart’, {
“contents”: [
{
“content_id”: “<content_identifier>”, // string. ID of the product. Example: “1077218”.
“content_type”: “<content_type>”, // string. Either product or product_group.
“content_name”: “<content_name>” // string. The name of the page or product. Example: “shirt”.
}
],
“value”: “<content_value>”, // number. Value of the order or items sold. Example: 100.
“currency”: “<content_currency>” // string. The 4217 currency code. Example: “USD”.
});

ttq.track(‘InitiateCheckout’, {
“contents”: [
{
“content_id”: “<content_identifier>”, // string. ID of the product. Example: “1077218”.
“content_type”: “<content_type>”, // string. Either product or product_group.
“content_name”: “<content_name>” // string. The name of the page or product. Example: “shirt”.
}
],
“value”: “<content_value>”, // number. Value of the order or items sold. Example: 100.
“currency”: “<content_currency>” // string. The 4217 currency code. Example: “USD”.
});

ttq.track(‘PlaceAnOrder’, {
“contents”: [
{
“content_id”: “<content_identifier>”, // string. ID of the product. Example: “1077218”.
“content_type”: “<content_type>”, // string. Either product or product_group.
“content_name”: “<content_name>” // string. The name of the page or product. Example: “shirt”.
}
],
“value”: “<content_value>”, // number. Value of the order or items sold. Example: 100.
“currency”: “<content_currency>” // string. The 4217 currency code. Example: “USD”.
});

ttq.track(‘CompleteRegistration’, {
“contents”: [
{
“content_id”: “<content_identifier>”, // string. ID of the product. Example: “1077218”.
“content_type”: “<content_type>”, // string. Either product or product_group.
“content_name”: “<content_name>” // string. The name of the page or product. Example: “shirt”.
}
],
“value”: “<content_value>”, // number. Value of the order or items sold. Example: 100.
“currency”: “<content_currency>” // string. The 4217 currency code. Example: “USD”.
});

ttq.track(‘Purchase’, {
“contents”: [
{
“content_id”: “<content_identifier>”, // string. ID of the product. Example: “1077218”.
“content_type”: “<content_type>”, // string. Either product or product_group.
“content_name”: “<content_name>” // string. The name of the page or product. Example: “shirt”.
}
],
“value”: “<content_value>”, // number. Value of the order or items sold. Example: 100.
“currency”: “<content_currency>” // string. The 4217 currency code. Example: “USD”.
});

My question is , do you have any idea where to find the code of the product page/add to cart page/checkout page and order confirmation page so i can put the code, and do i have to do anything else.

Thank you very much!

Hi,

Thanks for your query.

The best way to track e-commerce events would be Google Tag Manager GTM.

GTM configuration follows these processes:

  1. Custom GTM script/datalayer setup on custom pixel
  2. Creating datalayer variable for event data(value, currency transaction id and user data for event match quality score EMQ)
  3. Triggers for the events you want to track
  4. Tiktok pixel tag for each event and assign variables and triggers.

Feel free to ask if you have any questions.

Kind Regards

Hi @Lambpartners99

You can insert your TikTok event scripts on theme.liquid for the global tracking and for the purchase event on theme.liquid (purchase event) and also on checkout.liquid use Shopify’s extra scripts field in the checkout settings. Product and cart events can be bound in product-template and cart-template respectively. Keep things dynamic with Liquid so your events send the right product and order data.

Hi! You can install the TikTok Pixel manually by adding the pixel code directly into your Shopify theme. Here’s the simplest step-by-step method:

1. Get your Pixel Code

  • Go to TikTok Ads Manager

  • Open Events Manager

  • Click Web Events

  • Create or select your Pixel

  • Choose Manual Install and copy the full pixel script

2. Add the base pixel to your Shopify theme

  1. In Shopify, go to Online Store → Themes → Edit Code

  2. Open the file: theme.liquid

  3. Paste the TikTok Pixel code right before the closing </head> tag

  4. Save

3. Add event tracking (optional but recommended)
TikTok gives event snippets like:

  • Add to Cart

  • Purchase

  • View Content
    Paste these inside the relevant template files:

  • product.liquid → for View Content

  • cart.liquid → for Add to Cart

  • checkout → Additional Scripts → for Purchase

4. Verify the Pixel
Download the TikTok Pixel Helper Chrome extension →
Visit your store → make sure the Pixel turns green and fires the correct events.