Track AddToCart
The AddToCart event fires when a visitor clicks the Add to Cart button on a product page. Meta uses this as a strong “buying intent” signal for retargeting and Smart Bidding.

1. Find your Add-to-Cart button selector
Open a product page, right-click your Add to Cart button → Inspect. Note its id (e.g. add-to-cart-button) or a unique class (e.g. .btn-add-to-cart).

2. Copy the snippet
Replace the example product info with template values that render the real product’s name, SKU, and price.
Option A — pbq (recommended)
<!-- Place inside the <body> of your product detail page,
AFTER the AdsPing script in <head>. -->
<script>
document.querySelector('#add-to-cart-button')
.addEventListener('click', function () {
pbq('track', 'AddToCart', {
content_name: 'Acme Hydrating Serum',
content_ids: ['SKU-1043'],
content_type: 'product',
value: 24.90,
currency: 'USD'
});
});
</script>Option B — dataLayer
<!-- Place inside the <body> of your product detail page,
AFTER the AdsPing script in <head>. -->
<script>
document.querySelector('#add-to-cart-button')
.addEventListener('click', function () {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'add_to_cart',
ecommerce: {
value: 24.90,
currency: 'USD',
items: [
{ item_id: 'SKU-1043', item_name: 'Acme Hydrating Serum' }
]
}
});
});
</script>3. Where to paste it
Paste it inside the <body> of your product detail page template, near the bottom — so the button element exists in the DOM by the time the script attaches the click listener.

4. Test it
Open a product page in your browser, click the Add to Cart button, then switch to your AdsPing dashboard. A AddToCart row appears in Recent Events within 10 seconds with a green Success badge.

✓ AddToCart is live.
Meta will start picking up cart additions as a buying-intent signal for retargeting and conversion optimization.