SaTracking
PlatformsNEWIntermediate

Install the TikTok Pixel base code once

Retrieve the account-generated base code, install it on eligible pages, and prevent duplicate initialization.

Download for AI (.txt)

Measurement topic illustration · SaTracking

Audience, prerequisites, and outcome

Place the base snippet once, confirm the pixel loads on every template and check the browser and server paths before adding any event code. You need access to Events Manager and to the site, a supported partner, or a GTM container. The goal is one account-generated base installation on the intended pages, with a clear owner and a verification record.

1. Inventory before installing

Search the site source, CMS integrations, partner apps, and every GTM container for an existing TikTok Pixel ID or base snippet. Record which pages load it, who owns it, and whether it is still needed. Do not paste a second base code just because you cannot find a recent event; diagnose the existing path first. TikTok's setup guide separates partner and manual setup and explains verification.

Expected result: the team can identify one intended installation owner and the pages that should load Pixel.

2. Retrieve the base code from the right data source

In Events Manager, select the correct web data source and choose the installation method that matches your deployment. For manual setup, use the Pixel base code generated for that specific Pixel in the account. Do not copy a Pixel ID or base code from an example, another client, or an old staging system. TikTok's Pixel overview describes the Pixel as website code that shares configured events; creating a data source alone does not install it.

Expected result: you have the generated code for the intended Pixel and know whether a partner, site code, or GTM will own it.

3. Install it once through the chosen route

For a direct install, follow TikTok's account-provided instructions for placing the base code on the site's pages. Keep it in the shared layout or approved tag integration so it loads once across eligible pages. For GTM, TikTok's documented account-template route uses the generated base code in a Custom HTML tag with an All Pages trigger, while event tags use the TikTok Pixel template. Its separate Events Manager connection can create GTM assets through a guided flow. Choose one base route; don't add direct code plus partner plus GTM for the same Pixel. See TikTok's GTM Pixel setup.

Expected result: one base initialization loads on each eligible page and no competing integration initializes the same Pixel again.

4. Keep event calls separate from base installation

The base establishes the Pixel library; it does not define every business conversion. A direct event call such as ttq.track('ViewContent', {...}) is a separate vendor event and must run after the base is ready, on the meaningful action. In GTM, configure a TikTok event tag and trigger after a business success signal. A generic data-layer push like this is only an internal queue message:

js
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ event: 'product_detail_viewed', product_id: 'SKU_123' });

The push does not contact TikTok unless a configured TikTok tag reads it and maps its values. Never copy a business event into the base code itself as a substitute for defined event behavior.

5. Verify coverage and troubleshoot

Use TikTok Pixel Helper to inspect detectable Pixel installation and errors. Test an eligible page and a page that should not load Pixel; verify the correct Pixel ID and one initialization. Then use Events Manager Test Events and Diagnostics to inspect event activity and surfaced issues. A helper result or GTM preview shows implementation evidence, not proof of provider processing or attribution. If the Pixel is missing, check the selected data source, published deployment, consent state, blockers, and whether the page template includes the shared tag. If it appears twice, compare direct code, plugins, partner connections, and all GTM containers before removing one.

Control the base code itself according to consent requirements; gating only later conversion tags may still load Pixel. TikTok's cookie guidance says where consent is required, cookie use should be disabled after refusal using a tag manager, CMP, or Pixel consent mode. Avoid personal data in URLs and automatic page metadata. Keep the code source, Pixel owner, consent behavior, and last review date in the site's tag inventory.

Official references

EDITORIAL HISTORY

What changed

  1. v1.0.0
    New bilingual guide drafted from current official TikTok sources; editorial review required before publication.
MEASUREMENT SUPPORT

Need a hand with your tracking?

Nicolas Salazar works with teams on analytics, tracking plans, data quality, consent, and implementation.