SaTracking
PlatformsNEWIntermediate

Track TikTok AddToCart after the cart changes

Send AddToCart only after an item is actually added, with the current product and cart data.

Download for AI (.txt)

Measurement topic illustration · SaTracking

Audience, prerequisites, and outcome

Fire AddToCart after the cart state actually changes, map content IDs and quantities, and check that quantity edits are not counted as new adds. You need a working Pixel base or GTM integration, a product page/cart that exposes reliable item data, and a signal that the cart actually changed. The goal is one event when an item is accepted into the cart, with values from that cart operation.

1. Define the successful cart change

TikTok defines Add to Cart as a visitor adding an item to the cart. Fire after the application confirms the cart mutation, not on a button click before validation, a disabled control, or an API request that later fails. Decide whether adding a second unit and adding a different product each produce one event; make the rule consistent with your cart model. See TikTok's standard event names and parameters.

Expected result: a test add action changes the cart and emits one business event; a rejected add emits none.

2. Map only the item that was added

TikTok lists content_type, quantity, description, content_ids, currency, and value as recommended AddToCart parameters. Use the identifiers and values available for the item in the successful cart mutation. content_ids should match the identifiers used in the destination catalog; choose content_type in line with the ID scheme (product or product_group where appropriate). Do not infer a price from displayed text if the cart has a canonical amount. The TikTok parameter reference describes these fields.

Expected result: the event's ID and quantity match the item that the cart accepted, not a stale product card or the whole cart by accident.

3. Direct Pixel API example

After the TikTok base code is installed and initialized, call its browser API on the confirmed cart-change signal. Sample values below are illustrative; replace them with the product ID, quantity, and amount from your real cart state:

js
ttq.track('AddToCart', {
  content_type: 'product',
  content_ids: ['SKU_123'],
  quantity: 1,
  value: 24.50,
  currency: 'USD'
});

This is an event call, not the Pixel base code. Do not call it again merely because the cart drawer opens or a page refreshes.

4. GTM and generic dataLayer are separate steps

With GTM, configure TikTok's event tag/template for AddToCart, use a custom event trigger for the application's confirmed cart signal, and map the current item variables. Preview a successful add and a rejected add. TikTok's GTM event tag guide describes selecting the TikTok Pixel template and custom event trigger.

An application may publish a generic data-layer message:

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

That queue message alone sends nothing to TikTok. A GTM TikTok tag must listen for cart_item_added and map product_id and quantity to the vendor fields. Keep business names separate from TikTok's AddToCart code.

5. Verify behavior, then fix the observed layer

In GTM Preview, confirm the custom event occurs only after the cart succeeds, the right trigger fires, and variables resolve. Use TikTok Pixel Helper and Events Manager Test Events to inspect browser event activity; use Diagnostics for surfaced implementation problems. A tag or helper observation does not prove TikTok processed or attributed the action. If nothing fires, check the cart success callback and consent; if values are empty, check the variable path and timing; if it fires twice, check both direct code and GTM, click and success triggers, or repeated SPA renders.

Do not send email, name, address, free-text notes, or other personal information as cart parameters. Use only product and amount details needed for the measurement purpose. Control the Pixel base and event tag according to the site's consent mechanism and applicable requirements. TikTok's cookie guidance says that where consent is required, cookie setting/usage should be disabled after a person declines, using a tag manager, consent platform, or Pixel consent mode.

Official references

EDITORIAL HISTORY

What changed

  1. v1.0.0
    New bilingual guide drafted against current official TikTok documentation; review before publication.
MEASUREMENT SUPPORT

Need a hand with your tracking?

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