How to add the TikTok pixel to Shopify

Alexander LamAlexander Lam

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

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:

  1. Head over to your TikTok ads dashboard. From the main menu, select Library > Event.
  2. In the Website Pixel card, click Manage. Then click the Create Pixel button.
  3. Name the pixel whatever you like, and select Manually install pixel code. Click Next to proceed.
  4. 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.

  1. Let’s head over to your Shopify admin. From the main men, select Online Store > Themes.
  2. For your current theme, click Actions and select Edit code.
  3. Under Layout, select theme.liquid.
  4. Ctrl+F and search for </head>.
  5. Paste your TikTok pixel in the line right before </head>.

We also need to add this code to your post-purchase thank you page.

  1. From your Shopify admin, go to Settings > Checkout.
  2. Look for Order processing. There is an Additional scripts text box in this section.
  3. Paste your TikTok pixel in the Additional scripts box.

2. Setup the TikTok 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.

  1. Click Next on the pixel installation step to proceed.
  2. On the page that appears, select E-Commerce Events.
  3. 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.
  4. Click Continue to setup event rules to proceed.
  5. We are now going to setup the Product Details event. Select Destination URL under Choose a tracking method.
  6. Click Add Rule. Enter /products/ in the text box for Rule 1. This will result in the rule Page URL Contains /products/. Then click Save.

3. Setup the TikTok Add to Cart event

  1. From the same screen as where we setup the View Product event, click on the Add to Cart tab.
  2. Select Click Events as the tracking method.
  3. We’re going to need the TikTok Pixel Helper for Chrome now. So go ahead and install that.
  4. On the left half of the page, enter the URL of your product page in the Website URL box. Then click Update.
  5. Your product page will load in a box on the page. Find your Add to Cart button, and click it. Then click Save.
  6. If you have additional Add to Cart buttons, repeat steps 4 and 5 for each other button.

4. Setup the TikTok Complete Payment event

  1. From the same screen as where we setup the Add to Cart event, click on the Complete Payment tab.
  2. Select Destination URL under Choose a tracking method.
  3. Click Add Rule. Enter /thank_you in the text box for Rule 1. This will result in the rule Page 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.

 

Comments 0
There are currently no comments.