Skip to content

Event codes for e-commerce industry

Before implementing the following WP Pixel examples at the beginning of the <body> section, you should add the initialization code in the section on each page of the site (WP Pixel installation on the page)

All pages – View

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

Product list page – ProductList

<script>
wph('track', 'ViewContent', {
    'content_name': 'ProductList',
    contents: [{
        id: 'PRODUCT_ID1',
        name: 'NAME1',
        category: 'CATEGORY1',
        price: 20.15,
        currency: 'PLN'/'EUR'/'USD'/'GBP'/'CHF'/'CZK'/'BGN'/'RON',
        sizes: ['s'],
        colours: ['blue'],
        weight: 1.2
    }, {
        id: 'PRODUCT_ID2',
        name: 'NAME2',
        category: 'CATETGORY2',
        price: 20.15,
        currency: 'PLN'/'EUR'/'USD'/'GBP'/'CHF'/'CZK'/'BGN'/'RON',
        sizes: ['s'],
        colours: ['blue'],
        weight: 1.2
    }]
})
</script>

Product page – ViewProduct

<script>
wph('track', 'ViewContent', {
    'content_name': 'ViewProduct',
    contents: [{
        id: 'PRODUCT_ID1',
        name: 'NAME1',
        category: 'CATETGORY1',
        price: 20.15,
        currency: 'PLN'/'EUR'/'USD'/'GBP'/'CHF'/'CZK'/'BGN'/'RON',
        sizes: ['s'],
        colours: ['blue'],
        weight: 1.2
    }]
})
</script>

Adding to cart – AddToCart

<script>
wph('track', 'AddToCart', {
    contents: [{
        id: 'PRODUCT_ID1',
        name: 'NAME1',
        category: 'CATETGORY1',
        price: 20.15,
        currency: 'PLN'/'EUR'/'USD'/'GBP'/'CHF'/'CZK'/'BGN'/'RON',
        quantity: 1,
        sizes: ['s'],
        colours: ['blue'],
        weight: 1.2
    }]
});
</script>

Post transaction summary page - Purchase

<script>
wph('track', 'Purchase', {
    transaction_id: 'ORDER_ID1',
    value: 97.56,
    value_gross: 120.0,
    shipping_cost: 19.9,
    discount_code: 'CODE15',
    contents: [{
        id: 'PRODUCT_ID1',
        name: 'NAME1',
        category: 'CATEGORY1',
        price: 80.0,
        currency: 'PLN'/'EUR'/'USD'/'GBP'/'CHF'/'CZK'/'BGN'/'RON',
        quantity: 1,
        sizes: ['s'],
        colours: ['blue'],
        weight: 1.2
    }, {
        id: 'PRODUCT_ID2',
        name: 'NAME2',
        category: 'CATETGORY2',
        price: 20.0,
        currency: 'PLN'/'EUR'/'USD'/'GBP'/'CHF'/'CZK'/'BGN'/'RON',
        quantity: 2,
        sizes: ['s'],
        colours: ['blue'],
        weight: 1.2
    }]
});
</script>