Skip to content

Event codes for e‑commerce

Before implementing the event codes, the pixel embed script should be added on every page of the website. Instruction

The expected data types for the parameters are outlined on the page:
Available events and required parameters

View ‑ all pages

<script>
  wph('track', 'ViewContent', { content_name: 'View' });
</script>

ProductList ‑ product listing page

<script>
  wph('track', 'ViewContent', {
    content_name: 'ProductList',
    contents: [
      {
        id: 'PRODUCT_ID1',
        name: 'PRODUCT_NAME1',
        category: 'PRODUCT_CATEGORY1',
        price: PRODUCT_PRICE1,
        currency: 'CURRENCY',
        weight: 'PRODUCT_WEIGHT1',
      },
      {
        id: 'PRODUCT_ID2',
        name: 'PRODUCT_NAME2',
        category: 'PRODUCT_CATEGORY2',
        price: PRODUCT_PRICE2,
        currency: 'CURRENCY',
        weight: 'PRODUCT_WEIGHT2',
      },
    ],
  });
</script>

ViewProduct ‑ product page

<script>
  wph('track', 'ViewContent', {
    content_name: 'ViewProduct',
    contents: [
      {
        id: 'PRODUCT_ID1',
        name: 'PRODUCT_NAME1',
        category: 'PRODUCT_CATEGORY1',
        price: PRODUCT_PRICE1,
        currency: 'CURRENCY',
        weight: 'PRODUCT_WEIGHT1',
      },
    ],
  });
</script>

AddToCart ‑ adding a product to the cart

<script>
  wph('track', 'AddToCart', {
    contents: [
      {
        id: 'PRODUCT_ID1',
        name: 'PRODUCT_NAME1',
        category: 'PRODUCT_CATEGORY1',
        price: PRODUCT_PRICE1,
        currency: 'CURRENCY',
        quantity: PRODUCT_QUANTITY1,
        weight: 'PRODUCT_WEIGHT1',
      },
    ],
  });
</script>

Purchase ‑ order confirmation page (post‑transaction)

<script>
  wph('track', 'Purchase', {
    transaction_id: 'TRANSACTION_ID',
    value: NET_VALUE_EXCLUDING_SHIPPING_COST,
    value_gross: GROSS_VALUE_EXCLUDING_SHIPPING_COST,
    shipping_cost: SHIPPING_COST,
    contents: [
      {
        id: 'PRODUCT_ID1',
        name: 'PRODUCT_NAME1',
        category: 'PRODUCT_CATEGORY1',
        price: PRODUCT_PRICE1,
        currency: 'CURRENCY',
        quantity: PRODUCT_QUANTITY1,
        weight: 'PRODUCT_WEIGHT1',
      },
      {
        id: 'PRODUCT_ID2',
        name: 'PRODUCT_NAME2',
        category: 'PRODUCT_CATEGORY2',
        price: PRODUCT_PRICE2,
        currency: 'CURRENCY',
        quantity: PRODUCT_QUANTITY2,
        weight: 'PRODUCT_WEIGHT2',
      },
    ],
  });
</script>