Ecommerce events not triggering from custom code

So I tried everything, but ecommerce events are simply not being triggered.

I am using wordpress, I have connect matomo plugin and I am self hosting matomo e.g matomo on premise.

I tried filling up the code dynamically by using product info, I even tried this:

// Push Product View Data to Matomo - Populate parameters dynamically
_paq.push(['setEcommerceView',
    "0123456789", // (Required) productSKU
    "Ecommerce Analytics Book", // (Optional) productName
    "Books", // (Optional) categoryName
    9.99 // (Optional) price
]);

// You must also call trackPageView when tracking a product view 
_paq.push(['trackPageView']);

just the plain simple code example that’s in the guide.

I found somewhere here that because the initialization code is already calling trackPageView that is the issue, so I truned off the plugin and just used custom code, and in that custom code I added only this:

// Push Product View Data to Matomo - Populate parameters dynamically
_paq.push(['setEcommerceView',
    "0123456789", // (Required) productSKU
    "Ecommerce Analytics Book", // (Optional) productName
    "Books", // (Optional) categoryName
    9.99 // (Optional) price
]);

// You must also call trackPageView when tracking a product view 
_paq.push(['trackPageView']);

and yet again still it didn’t work and no ecommerce view event is being called…

Can anyone give me a hand for this, anything at all I would appreciate it greatly as I need to get this done asap but I’ve literally ran out of ideas what to try and test and see if it will work…

Hi @fahir,

Well, I assume your page view was tracked correctly. Is that correct?

So if Matomo tracking is working, but the ecommerce view isn’t being tracked, it could be that you haven’t enabled ecommerce for the tracked website.

Regards Udo

hello and thank you very much for the response. My ecommerce tracking is enabled.

And I can track purchases, see the attached image:

however, the ecommerce view has an issue, it’s not being called…

Hi @fahir ,
How do you know it’s not working?
Note: Neither the visit log nor the ecommerce log will show that a page view was tracked as an ecommerce view.
The only place to look is here later, when your reports have been generated (see red frame):

Regards Udo

So the ecommerce view will not show in the logs like the ecommerce order shows in the image above?

I thought it will show there?

Same as cart changes, cause I also have issues with cart where abandoned cart shows after someone adds to cart… But I first wanted to fix the ecommerce view…

Exactly. The Matomo logs don’t show you any ecommerce view.
You only find either page views or shopping cart changes.

Okay that makes sense, thank you for that. Now that I checked in the products I do see views for the products. Okay that’s nice.

BTW, do I still need to call _paq.push([‘trackPageView’]); for the ecommerce view event even though it’s being called at the initialization?

Also, do maybe have an idea why when I use this:

_paq.push(['addEcommerceItem',
    "0123456789", // (Required) productSKU
    "Ecommerce Analytics Book", // (Optional) productName
    ["Books", "Best sellers"], // (Optional) productCategory
    9.99, // (Recommended) price
    1 // (Optional, defaults to 1) quantity
]);

// Pass the Cart's Total Value as a numeric parameter
_paq.push(['trackEcommerceCartUpdate', 15.5]); 

Abandoned cart is called in the log view…

Yes, you need the trackPageView to track the ecommerce view. Like in your example above.

Regarding abandoned carts: As soon as you add a product to the cart and haven’t yet purchased it, the Matomo log shows it as if the cart had been abandoned.

Only when you make a purchase does it change to an order.

From what I can see in your screenshots, everything is normal and as it should be.

Regards Udo

Okay thank you very VERY much. The problem is I didn’t understand how matomo ecommerce view works, I thought it should show in the logs. And also didn’t understand how the cart works, so basically even though you call set cart it shows cart abandoned… thank you…

While you’re being friendly if I can take advantage of that with another question…

In regards to matomo white label, are there following options:

1 - Hide the plugin marketplace from the users

2 - Limit how many websites they can create

Thank you very much again.

Hello @fahir,

I’m not familiar with the white label solution. However, I would understand the two points you mentioned as they are formulated.