leadstoolpack

Home › How-tos › The Secret Setups › TikTok

The Secret Setups · 12 of 20

How to send TikTok Pixel events through Google Tag Manager

Live guide · Checked 28 October 2026 · Updated 28 October 2026 · Checked every week against TikTok's own help pages

Install the TikTok Pixel through Tag Manager and send SubmitForm, Contact and CompletePayment from your dataLayer, with an event ID ready for the Events API.

Time
20 minutes
You will need
  • A TikTok Ads Manager account
  • Google Tag Manager with the generate_lead trigger
  • Consent Mode set up
Stuck?
Troubleshooting or ask us a question

Step by step

  1. Make the pixel

    In TikTok Ads Manager go to Tools > Events > Web Events > Set up web events, choose TikTok Pixel, then Manually set up and Custom code. Copy your Pixel ID.

  2. Add the base code

    In Tag Manager: Tags > New > Custom HTML, fire on All Pages, and require ad_storage in Consent Settings. Paste your pixel's base code from TikTok; it looks like this:

    HTML
    <script>
    !function (w, d, t) {
      w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie","holdConsent","revokeConsent","grantConsent"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e},ttq.load=function(e,n){var r="https://analytics.tiktok.com/i18n/pixel/events.js";ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=r,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};var o=d.createElement("script");o.type="text/javascript",o.async=!0,o.src=r+"?sdkid="+e+"&lib="+t;var a=d.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)};
      ttq.load('YOUR_PIXEL_ID');
      ttq.page();
    }(window, document, 'ttq');
    </script>

    Always copy the newest base code from your own Ads Manager: TikTok updates it from time to time.

  3. Send leads from the dataLayer

    Another Custom HTML tag on CE - generate_lead, with the base tag set to fire first in Tag Sequencing:

    HTML
    <script>
      ttq.track('{{DLV - lead_type}}' === 'call' || '{{DLV - lead_type}}' === 'email' ? 'Contact' : 'SubmitForm', {
        value: {{DLV - value}},
        currency: '{{DLV - currency}}',
        content_name: '{{DLV - form_id}}'
      }, { event_id: '{{DLV - lead_id}}' });
    </script>
  4. Send purchases

    For shops, on the purchase event:

    HTML
    <script>
      ttq.track('CompletePayment', {
        value: {{DLV - ecommerce.value}},
        currency: '{{DLV - ecommerce.currency}}',
        content_type: 'product'
      }, { event_id: '{{DLV - ecommerce.transaction_id}}' });
    </script>
  5. Test with Pixel Helper

    Install the TikTok Pixel Helper browser extension, open Preview and send a test lead. The helper should show SubmitForm with no errors. In Ads Manager, Web Events > your pixel > Test events shows them live.

  6. Make it an optimisation event

    Publish in Tag Manager. In Ads Manager, the event appears under your pixel within a few hours: choose it as the Optimization event in your lead campaigns.

Tips from people who set these up every week

  • Use the same event_id later in TikTok's Events API, and TikTok will count the lead once.
  • SubmitForm is TikTok's standard lead event; Contact suits calls and emails.

Troubleshooting: questions and answers

Pixel Helper says 'no pixel found'.

The base tag waits for consent. Accept your cookie banner and reload.

Events show with a warning about parameters.

Value must be a number and currency a three-letter code like GBP. Check your Data Layer Variables aren't empty.

Official help pages

Let Claude fix the rest of your funnel

Lead Focus is 12 Claude Skills that find the stage of your funnel that's costing you leads, then fix it: ads, landing pages, follow-ups and tracking. One payment, 12 months of updates, and a 14-day refund.

Get Lead Focus · $29.99

Still stuck, or have a question?

Tell us where you got to and what you see. We read every message and reply by email, usually the same working day.