Meta · Track an eventStep 1 of 3

Track ViewContent

The ViewContent event fires when a visitor opens a product detail or service detail page. Meta uses this to build retargeting audiences and to seed Smart Bidding with browsing signals.

Example of a product detail page
ViewContent fires every time someone lands on a product / service page.

1. Copy the snippet

Use template variables to fill in the real product’s name, SKU, and price — not the static example below.

Option A — pbq (recommended)

product-page.html
<!-- Place inside the <body> of your product / service detail page,
     AFTER the AdsPing script in <head>. -->
<script>
  pbq('track', 'ViewContent', {
    content_name: 'Acme Hydrating Serum',
    content_ids: ['SKU-1043'],
    content_type: 'product',
    value: 24.90,
    currency: 'USD'
  });
</script>

Option B — dataLayer

product-page.html
<!-- Place inside the <body> of your product / service detail page,
     AFTER the AdsPing script in <head>. -->
<script>
  window.dataLayer = window.dataLayer || [];
  window.dataLayer.push({
    event: 'view_content',
    ecommerce: {
      value: 24.90,
      currency: 'USD',
      items: [
        { item_id: 'SKU-1043', item_name: 'Acme Hydrating Serum' }
      ]
    }
  });
</script>

2. Where to paste it

Paste it inside the <body> of your product / service detail page template — the same template every product / service page is built from. That way one paste covers every product on your catalog.

Code editor showing ViewContent in the product page template body
Put it in the product detail template, not in a per-product file.

3. Test it

Open any product page in a fresh browser tab. A ViewContent row appears in your Recent Events within 10 seconds with a green Success badge. Open a second product page — a second ViewContent row appears.

AdsPing Recent Events showing two ViewContent events

✓ ViewContent is live.

Meta will start building retargeting audiences from your product page visitors.