Updating existing product names

Hi,

We have series of orders tracked in Matomo. For reasons outside of our control, these orders were tracked without a product name set. Our tracking code set the product name as “Unknown” as part of it’s own logic, though the SKU was unique.

What’s happened is that we have a large number of orders attributed to the product with name=“Unknown”. Looking at the database, I can see that this is represented as follows:

select
(SELECT name from analytics.piwik_log_action where type=5 and idaction=i.idaction_sku limit 1) as SKU,
(SELECT name from analytics.piwik_log_action where type=6 and idaction=i.idaction_name limit 1) as product_name
from piwik_log_conversion_item i

The idaction_name column contains the ‘17855005’ value for any product with the “Unknown” product name while the idaction_sku contains a unique value.

Piwik has no product table, and the product names, SKUs and categories are stored as disconnected “idaction” records. This creates an issue where if the name is identical, the system will use the existing idaction record even if the SKU is different.

Usually this is o.k., except in the case of Unknown and duplicate product names. It’s creating the following issues

  1. incorrect and misleading grouping around “Unknown” in the product name report.
  2. We can’t update a product name for a given item without affecting all records connected to that shared idaction.

I’m here to hopefully understand how we can safely address item 2. That is, how can we create a new idaction that represents the correct product name we want and retroactively update the conversion (and anything else requiring updating).

My thought is to manually call

TableLogAction::loadIdsAction

from core\Tracker\TableLogAction.php

To create the new product name “idactions” and then retroactively update the conversion items.

Let me know if thats even in the ballpark. Thanks!