Content Tracking in Wordpress Plugin doesn't work

I’m currently testing if the Wordpress plugin works for one of my websites. I would like to track all my Woocommerce products via Content Tracking.
For this purpose I have included data-track-content in the product-loop in the div-elements shown as a preview.

At the end of the page where the product-loop is placedI have added the following:

var _paq = window._paq [];
_paq.push(['trackVisibleContentImpressions']);
_paq.push(['trackPageView']);

In the settings of the Wordpress plugin I tried the different options under ‘Enable content tracking’, but I see in the network analysis that the POST requests always have the status 500 and no tracking is visible in Matomo.

What could be the problem here?

Hi,

Can you see an error message in some log (php error log, wordpress log?)?

Could you send us a URL to a page where you have implemented this so we can take a look and possibly debug why it isn’t working? Feel free to email us at wordpress at matomo.org

Otherwise maybe you could paste an image of some of the HTML elements where this is set up so we can see if anything is missing. Eg making sure there are no typos, there is a content name and content piece set etc.

Unfortunately I cannot do that, the site is only available with VPN.

This is what my HTML elements look like:

<a onclick="trackContentInteraction(this)"
     data-track-content
     data-content-name="<?php echo the_title();  ?>"
     data-content-piece="Vorschau"
     data-content-target="<?php echo the_permalink(); ?>"
     href="<?php echo the_permalink(); ?>"
>

I think there might be a mistake with content-name, as this is what the POST Parameters look like:
matomo_content_parameter

Content piece and Content Target are displayed correctly.

This is what my php error log says:

[Tue Apr 21 15:52:51.513287 2020] [php7:error] [pid 22218] [client X:52733] PHP Fatal error: Uncaught Error: Call to a member function autocommit() on null in /var/www/X/public_html/X/wp-content/plugins/matomo/classes/WpMatomo/Db/WordPressTracker.php:184\nStack trace:\n#0 /var/www/X/public_html/X/wp-content/plugins/matomo/app/plugins/BulkTracking/Tracker/Handler.php(78): Piwik\Tracker\Db\WordPress->beginTransaction()\n#1 /var/www/X/public_html/X/wp-content/plugins/matomo/app/plugins/BulkTracking/Tracker/Handler.php(36): Piwik\Plugins\BulkTracking\Tracker\Handler->beginTransaction()\n#2 /var/www/X/public_html/X/wp-content/plugins/matomo/app/core/Tracker.php(134): Piwik\Plugins\BulkTracking\Tracker\Handler->onStartTrackRequests()\n#3 /var/www/X/public_html/X/wp-content/plugins/matomo/app/core/Tracker.php(112): Piwik\Tracker->track()\n#4 /var/www/X/public_htm in /var/www/X/public_html/X/wp-content/plugins/matomo/classes/WpMatomo/Db/WordPressTracker.php on line 184, referer: https:// X .de/praxistage/index.php/vorschau/

Thanks for this Christina. Two weeks ago we’ve applied a fix for bulk requests in Force POST for bulk requests, fix alwaysUseSendBeacon not respected for bulk requests by tsteur · Pull Request #15784 · matomo-org/matomo · GitHub and this fix will be included in the next release which should be in the next 3-7 days. I wonder if this maybe fixes it. But it seems likely more related to the DB error anyway.

Thanks a lot for posting this error message! Any chance you can apply these changes to see if this fixes the issue? Fix starting a transaction might not work by tsteur · Pull Request #260 · matomo-org/wp-matomo · GitHub

Tracking code is help to collect every code and display word press page . If this is not appear then you can check wordpress setting and tracking activation tab.

I have just updated the plugin to the latest version, but the error still occurs.

In Matomo I only get the same 4 of the actually displayed content blocks as impressions over and over again.

The POST parameters still look the same, the php error log now says

PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0, referer: https:// X /vorschau/

Although I have already increased max_input_vars to 1500.