Open tsteur opened 3 years ago
I haven't thought much about it but maybe there could be a tracking mode "Ecommerce only" which can then be used when they embed the tracking code themselves. So we would only print ecommerce tracking code. For this to work correctly they might still though need to configure cookie domain (if they configured one in the actual tracking code).
It's not a nice solution since it won't work out of the box this way and all users first run into a problem and need to figure out how to fix this. It could be a temporary workaround maybe and is likely quick to implement.
A workaround for this problem might be to set tracking mode to "Manually" and leaving the tracking code field empty. I haven't tested it but thinking this could work.
Think I may also be effected by this, no data in overview, log, products, but am getting data in sales. Any updates on progress for a fix on this one? TIA!
Hello @MassStash
Would you mind copy paste your system report please?
Kind regards
Mat
Same issue here. I mange matomo via the cookie consent tool :
https://dsgvo-for-wp.com/dokumentation/
Here it state the tracking must be disabled. And I can't confederate it to track a thing without the option enable Ecommerce.
The Workaround has some problems if the purchase thank you URL is like:
/kasse/order-received/12345/?key=wc_order_y8OiHaluf6WcG
It will detect an abandon cart instate of a purchase. Maybe it is related to WooCommerce order not tracked #202
I could correct it with overriding the function maybe_track_order_complete in \wp-content\plugins\matomo\classes\WpMatomo\Ecommerce\Woocommerce.php with:
public function maybe_track_order_complete() { global $wp;
if ( function_exists( 'is_order_received_page' ) && is_order_received_page() ) {
$order_id = isset( $wp->query_vars['order-received'] ) ? $wp->query_vars['order-received'] : 0;
if($order_id == 0){
$tokens = explode('/', $_SERVER['REDIRECT_URL']);
if(isset($tokens ) && is_array($tokens ) && sizeof($tokens ) >1){
$order_id = $tokens[sizeof($tokens)-2];
}
}
if ( ! empty( $order_id ) && $order_id > 0 ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->on_order( $order_id );
}
}
}
Best regards Collie-IT
See https://github.com/matomo-org/matomo-for-wordpress/wiki/Ecommerce-tracking for some ecommerce background.
Currently, ecommerce tracking doesn't work when the tracking mode in
WP Admin Dashboard -> Matomo Analytics -> Settings
is disabled. This is done in https://github.com/matomo-org/matomo-for-wordpress/blob/4.3.1/classes/WpMatomo.php#L230However, some users might have the tracking mode set to disabled because they use a different plugin to set the tracking code. For example using a tracking consent plugin. In that case the tracking mode is set to disabled since another plugin adds the tracking code.
Ideally, the
Enable Ecommerce
feature can also be configured when the tracking mode is set to disabled. Similar to the currency setting:The problem though is that: Ecommerce tracking is enabled by default meaning we might start tracking data (server side) as soon as the plugin is installed even though the user doesn't want to track data just yet. Meaning we might need a different setting for "Enable ecommerce" when tracking mode = disabled. For this other ecommerce setting the default value would be "disabled/false" and it would only be shown when tracking mode = disabled. To the user visible would be always the same setting but in the background we would have two different settings and depending on the selected mode we show one or the other.
There is still yet another issue though. If for example someone uses a consent plugin to insert the Matomo tracking code, then product views, cart updates and orders should be only tracked when the user has given consent. This works nicely with our ecommerce feature when we are tracking these things using the JavaScript code. Because while we would always add tracking code methods like
_paq.push(['trackEcommerceCartUpdate', ...])
they wouldn't do anything if the JS tracking code wasn't loaded by the consent tools.The problem comes when cart updates or orders are done using ajax and we fall back to server side tracking. Then we can't know if someone is using a consent tool and whether tracking is allowed or not and our plugin would always track ecommerce actions even if there is not any consent. I don't know if there is any way for us to workaround this as we can't know if consent is required and when consent was given. So for this ecommece tracking when tracking mode is disabled we can kind of only rely on JS tracking which often wouldn't work likely.