Opencart Extension - What category to attribute after Site Searches

Hi All,

I’m the developer of the Opencart Extension to tie into Matomo , and I’m doing a new version to support the latest Opencart & Matomo. There’s one last thing that I’m not sure what to do - more from a principle point of view, rather than anything technical.

I’m thinking about the special case of a Product View on an eCommerce product page, as per;
But when someone arrives at that Product Page solely doing a Site Search. In this case, there is no “Category” they have navigated through.

What do you think I should track as the category in this situation? I see a few options, but none seem ideal;

  1. Leave as ‘false’, with no specific category. This means the eCommerce ‘Product Categories’ report has this (and any resulting sales!) marked against “Product Category not defined”.
  2. Pick a category the product is in, say a primary one. This seems problematic and is my least favourite. This seems biased, and what do I pick the category based on?
  3. Report the array of all the categories the product is in. Again, slightly problematic, but not nearly as much. This means the statistics for the categories may be skewed. It will show as a view/sale against this category where this category itself was never viewed and arguably shouldn’t get the sale? e.g. if using the conversion rates of Categories to improve landing pages, the figures won’t only reflect the effect of the category page.
  4. Report a separate ‘special’ category e.g. “Site Search Result”. This is similar to 1) but superior as it doesn’t have a nasty undefined. It also keeps the statistics for the category pages more accurate if using for the landing pages, but maybe less accurate if you want to see how many items sold which exist in a specific category.

It all depends what the intent is and what users usually use the “Product Categories” report for, which I don’t know as much about. Any opinions based on your experience?


I vote for 4+2 e.g. “Site search primary product category” or 2+4 “Primary product category site search”

It’s a operational view and vote, since you u refer to a product page view.

2 only is compelling too

Hey Pak, thanks for your input, really useful. I’ve realised this isn’t limited to Site Search actually, the same challenge applies for any cart operations or ecommerce orders.

Ideally I would hope that Matomo could track the progression of the user through the site, and attribute each action e.g. eCommerce Order, to a Category based on it’s analytics e.g. if someone buys Product “A” after navigating through category “Phones” that sale would be attributed to “Phones”. As it stands I have to name a category when the purchase happens, but the page data in PHP at that point (on Checkout Success page) has no idea about the categories visited 1, 2, 3 or more pages ago which the sale should be attributed to.

I suppose I could add lots of variables and track the users progression through the website myself to work out the attribution, but seems to be taking on the duty of analytics so I’m hesitant to make it too complicated.

At the moment for the first release I have just gone for attributing to All categories the product is in. Many stores will just have a simple hierarchy with only 1 category for each product so will work perfect for that. For more complex situations I will revise once I get some feedback from people and see what the preference is.

Thanks for your input, any more ideas keep em coming!

PS. New extension now available at