Piwik Integration with WordPress for ECommerce

Hi @pslonina, thanks for your reply.

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

@Mihir_Jadi - sure, let me run a quick research on it. I’ll get back to you with answers tomorrow :slight_smile:

1 Like

Thanks @pslonina :slightly_smiling_face:

I’m also doing the same here. Please let me know if you get anything first.

Hi @pslonina :slightly_smiling_face:

I want to send dynamic data to piwik server.
I followed the documentation regarding it, but didn’t get clear idea, here is the documentation which I am following:

Here are my few queries on it:

  1. Which type of Tag and Trigger should be made on Piwik Pro → Tag Manager, and how can I define action event on it.
  2. After creating the Tag how can we pass dynamic data from our Website to Piwik Pro for analytics.

So, can you please give a clear flow on it ?

Regards,
Mihir

Hi @Mihir_Jadi ,
Thank you for your patience. I’ve been looking into different plugins and scenarios and I think we could take a different approach. Please install the free version of CoCart to enable cart API. Once that’s done - I’ll provide you with a script (or scripts) for tracking ecommerce events.

Thanks,
Piotr

Hi @pslonina

I have fetched all required data from WooCommerce and built custom script and added it to page footer.

Will it work with Piwik or not ?

Hi @Mihir_Jadi,
Please let me know where can I see the result of your work.

Thanks,
Piotr

Hi @pslonina

Here is the link of pages:

  1. Single product page:https: //lxt.gbtevents.com/product/prestbury-golf-club-thurs-7th-oct-2021/
    2.Cart page: https://lxt.gbtevents.com/basket/

3.Order received page: https://lxt.gbtevents.com/checkout/order-received/9342/?key=wc_order_g0FmtJWKriV0K

Here is the screenshots of the script which we have added inside footer:

  1. On Order Confirmation Page: https://i.imgur.com/fKe1aQ4.png

  2. On Cart Page : https://i.imgur.com/4EpRWsg.png

  1. On Single Product Page : https://i.imgur.com/G3ZHuee.png

Hello @Mihir_Jadi,
I’ve reviewed your setup and it seems we are almost there, yet there are still some bits and pieces that require a slight touch-up. Please see more details below:

  1. General observations
  • There is an additional condition defined for the All page views trigger (it fires only on /checkout/order-received page path). Please note that Piwik PRO tag relies on this trigger, and therefore - the Piwik PRO tag doesn’t work correctly at the moment.
  1. The Product page

Single product page: https://lxt.gbtevents.com/product/prestbury-golf-club-thurs-7th-oct-2021/

  • Currently, the Add to Basket tag is fired on page view on the product page (the Product View trigger). You might want to reconsider this.
  • The _paq.push(["trackEcommerceCartUpdate",cart_amount]); line is missing in the Add to Basket tag, please see the example in this article.
  • Ideally - the data layer event should be pushed once a user clicks on the Add to basked button. It should represent the whole cart (not only the product the user is currently looking at)
  • The cart_amount key-value pair is missing in the data layer object (please see the example in this article)
  • Please note that the SKU should be a string (you can either change it in the data layer object or use .toString() method in your tags.
  1. The cart

Cart page: https://lxt.gbtevents.com/basket/

  • Please note that the SKU should be a string (you can either change it in the data layer object or use .toString() method in your tags.
  • The Cart Update tag and the cart_update data layer both look good, but the cart_update object should be pushed to the data layer every time something is added to the cart (or removed from the cart).
  1. Order confirmation

Order received page: https://lxt.gbtevents.com/checkout/order-received/9342/?key=wc_order_g0FmtJWKriV0K

  • The Test order confirmation tag is being executed by 2 triggers - order_confirmation and All page views (the one with the condition described above). That makes the tag to fire twice.
  • Please note that the SKU should be a string (you can either change it in the data layer object or use .toString() method in your tags.

To summarize what should be done in order for this implementation to work correctly:

  1. Please fix the All page views trigger and make sure the Piwik PRO tag works correctly. If the Piwik PRO tag doesn’t fire - other tracker methods won’t work either (It’s one of the reasons behind the issues described in the other post.
  2. You only need 2 tags/2 data layer objects:
  • Cart update - anytime anything is added/removed to/from the cart.
  • Order confirmation - anytime an order is confirmed/
  1. Please make sure that the SKU is a string (you can either change it in the data layer object or use .toString() method in your tags. This is one of the reasons behind the issues described in the other post.

I hope the above helps. Please don’t hesitate to submit additional questions under this thread :wink:

1 Like

Okay @pslonina

Thank you :grinning:

So, basically I need to make these 2 changes:

  1. To remove additional event condition from All page views trigger.
  2. To make SKU a string.

Right ?

There is one more thing to do - please make sure that the cart update tag is being fired anytime anything is added/removed to/from the cart. Please note that it needs to iterate through the whole cart (not only the last added product).

1 Like

Thank You @pslonina :grinning:

Now everything is working fine ! :v: :+1:

I’m more than happy to hear that - thanks for the update @Mihir_Jadi :slight_smile: :+1:

1 Like

Hi @pslonina :slightly_smiling_face:

My Piwik Pro tag is fired 2 times on page load. Due to which the Analytics is not getting data. Website Link: https://gbt.events/

I checked everything but still it’s firing 2 times: Screenshot by Lightshot.

So, can you please suggest me what could be the issue ?

Hi @Mihir_Jadi,
I’ve checked it on my end and it seems that everything is working fine. Can you confirm that the issue still occurs?

Hi @pslonina,

I checked, it’s working now.

Thank You :grinning: