Getting bandwidth plugin results visible in Matomo

Hi,

I’m hoping to get help with the bandwidth plugin.

I’ve got a Matomo install working well. I installed the bandwidth plugin and was hoping to see results. After they didn’t show up for a while, I checked the plugin to make sure it was activated. It is.

Then I saw the FAQ (posted below)

Unfortunately, I can’t make sense of this. The log importer link is out of date and the HTTP Tracking API seems to go into more detail than I need.

I’m looking for some guidance on how to add the this to the Tracking API. I haven’t messed with the Tracking API before, just running it as it came and using the WP-Matomo plugin in WordPress using “default tracking” in the tracking code.

I’d also appreciate some clarity on this:

you can specify the bandwidth in bytes by appending the URL parameter bw_bytes=1234 to the tracking URL. In this case a bandwidth of 1234 bytes will be tracked.

Does this mean setting a sort of “default” connection speed to measure against?

Thanks!

Bandwidth FAQ copy and pasted here for convenience

How can I track the bandwidth?

Log analytics:

The bandwidth will be automatically tracked when using the log importer as long as your log format is supported.

Tracking API:

If you are using the HTTP Tracking API you can specify the bandwidth in bytes by appending the URL parameter bw_bytes=1234 to the tracking URL. In this case a bandwidth of 1234 bytes will be tracked.

Which actions support tracking of bandwidth?

Pageviews (Page URLs and Page Titles) as well as Downloads.

In which reports is the used bandwidth displayed?

  • Page URLs
  • Page Titles
  • Downloads

All reports will show a column Average Bandwidth and Sum Bandwidth

The “Visitors => Overview” report shows a total bandwidth overview and it is possible to view the evolution over period.

Which APIs does this plugin define or enrich?

There is a report Bandwidth.get returning the total bandwidth (across all actions).

It also enriches varies reports such as Actions.get , Actions.getPageUrls , Actions.getPageTitles and Actions.getDownloads . For example it adds columns such as avg_bandwidth , sum_bandwidth , min_bandwidth , max_bandwidth to each page view.

Why are the bandwidth columns are not displayed in the UI?

Make sure the Bandwidth plugin is activated by going to Administration => Plugins . Also the bandwidth columns are not displayed if no bandwidth was tracked in the current selected month.

Is it possible to track bandwidth using the Matomo (Piwik) JavaScript Tracker?

Yes, you can set the bw_bytes value manually in JavaScript using _paq.push(['appendToTrackingUrl', 'bw_bytes=1234'); to track the bandwidth of your pages.

Hi,

It seems like you stumbled across one of the badly documented features of log-analytics. It seems like this was added in 2015 and no one changed it since.

Nevertheless the feature exists. But of course log analytics can only record it if the data actually exists. Assuming you use Apache or Nginx, this is the regex that matches:

You can see that it matches for a length as the last number in the log line.

When I check my nginx logs, I can’t see anything about the length of the request, so maybe it doesn’t log this by default.

So I would make sure your logs contain the file size as otherwise there is nothing to track.