Piwik Integration with WordPress for ECommerce

We are integrating Piwik Pro Plugin with WordPress for ECommerce Tracking.

Flow:

  1. We want to collect data dynamically from WordPress and fed it to Piwik Pro.
  2. Secondly, the data should be displayed on our WordPress site:
    i. On Order-Recieved page: Screenshot
    Sample static code which we got from Piwik Documentation, this needs to be
    implemented dynamically in Piwik Tag Manager:
   window.dataLayer.push({
       event: "order_confirmation",
       products: [{
            sku: "9",
            name: "Clitheroe Golf Club",
            category: [
                "GBT Events 2021",
            ],
            price: 85.00,
            quantity: 1,
        },
        {
            sku: "7",
            name: "Reddish Vale Golf Club",
            category: [
                "GBT Events 2021",
            ],
            price: 65.00,
            quantity: 1,
        },
    ],
    order_id: "9231",
    grand_total: 0.00,
    subtotal: 150.00,
    tax: 0.00,
    shipping: 0.00,
    discount: 150,
});

ii. On Checkout page: Screenshot
Sample static code which we got from Piwik Documentation,this needs to be
implemented dynamically in Piwik Tag Manager:
```
window.dataLayer.push({
event: “cart_update”,
products: [{
sku: “7”,
name: “Reddish Vale Golf Club”,
category: [
“GBT Events 2021”,
],
price: 65.00,
quantity: 1,
},
{
sku: “9”,
name: “Clitheroe Golf Club”,
category: [
“GBT Events 2021”,
],
price: 85.00,
quantity: 2,
},
],
cart_amount: 235.00,
});

iii. On Product Detail Page: [Screenshot](https://prnt.sc/1e9moyx)
    Sample static code which we got from Piwik Documentation, this needs to be 
    implemented dynamically in Piwik Tag Manager:

window.dataLayer.push({
event: “add_item”,
products: [{
sku: “7”,
name: “Reddish Vale Golf Club”,
category: [
“GBT Events 2021”,
],
price: 65.00,
quantity: 1,
},
],
});

We want to fed dynamic data to Piwik and change according to each specific order and display the data as above screenshots on our WordPress site. 

So, for these features ,do we need create a Custom WordPress plugin which can send data dynamically to Piwik ? Or is there any Piwik Pro feature which can do these ?

Please provide me if any other solution. Or if we are following long documentation then please suggest how to apply it shortly. 

Thank You.

Hi @Mihir_Jadi, thanks for reaching out! :slight_smile:

The logic behind communicating e-commerce events through the data layer needs to be covered on the website itself. Therefore - creating a custom WordPress plugin for that seems to be a viable solution.

Another way to go - providing that you are using WooCommerce - would be using one of the existing WordPress plugins which communicate e-commerce events to the data layer. That said - the data layer objects structure would probably be a bit different than the one described in the documentation, therefore - the e-commerce configuration would have to be adjusted a bit too.

I hope the above helps. Please don’t hesitate to follow up on this thread if you need more details.

Thanks!

Hi @pslonina, thanks for your reply.

Can you please suggest WordPress plugin which can communicate e-commerce events to data layer ?