If you’re wondering how to add the TikTok pixel to Shopify, you’ve come to the right place. In 3 simple steps, I’ll show you how to add the base code, View Product event, Add to Cart event and Complete Payment (aka Purchase) event.
1. Install the base TikTok pixel in Shopify
Let’s start with the base code. This is the code that goes on every page and lets TikTok track your visitors for you. First, we’ll go grab your TikTok pixel code:
- Head over to your TikTok ads dashboard. From the main menu, select Library > Event.
- In the Website Pixel card, click Manage. Then click the Create Pixel button.
- Name the pixel whatever you like, and select Manually install pixel code. Click Next to proceed.
- You’ll arrive on a a page with your TikTok pixel. Click Copy Pixel Code.
Now that we have the code, we’re going to add it to your Shopify theme.
- Let’s head over to your Shopify admin. From the main men, select Online Store > Themes.
- For your current theme, click Actions and select Edit code.
- Under Layout, select theme.liquid.
- Ctrl+F and search for
</head>
. - Paste your TikTok pixel in the line right before
</head>
.
We also need to add this code to your post-purchase thank you page.
- From your Shopify admin, go to Settings > Checkout.
- Look for Order processing. There is an Additional scripts text box in this section.
- Paste your TikTok pixel in the Additional scripts box.
2. Setup the TikTok Pixel View Product event
The rest of these steps will happen in your TikTok ads dashboard, so let’s head back there.
We left off on the pixel installation step on the Events Manager page, so we’re going to pick back up from there.
- Click Next on the pixel installation step to proceed.
- On the page that appears, select E-Commerce Events.
- Click on the trash bin icon next to Place an Order. We won’t be needing this event since it’s essentially the same thing as Complete Payment.
- Click Continue to setup event rules to proceed.
- We are now going to setup the Product Details event. Select Destination URL under Choose a tracking method.
- Click Add Rule. Enter
/products/
in the text box for Rule 1. This will result in the rulePage URL Contains /products/
. Then click Save.
3. Setup the TikTok Pixel Add to Cart event
- From the same screen as where we setup the View Product event, click on the Add to Cart tab.
- Select Click Events as the tracking method.
- We’re going to need the TikTok Pixel Helper for Chrome now. So go ahead and install that.
- On the left half of the page, enter the URL of your product page in the Website URL box. Then click Update.
- Your product page will load in a box on the page. Find your Add to Cart button, and click it. Then click Save.
- If you have additional Add to Cart buttons, repeat steps 4 and 5 for each other button.
4. Setup the TikTok Pixel Complete Payment event
- From the same screen as where we setup the Add to Cart event, click on the Complete Payment tab.
- Select Destination URL under Choose a tracking method.
- Click Add Rule. Enter
/thank_you
in the text box for Rule 1. This will result in the rulePage URL Contains /thank_you
. Then click Save.
That’s it! Your tracking for TikTok ads is setup. You’re now good to go for the TikTok pixel in Shopify.