Archive not being used?

Hey,

My main use with Piwik is with custom variables to show stats on specific pages. So a lot of my API requests with PHP use the segment parameter. For instance, a common one is:


$piwik->makeRequest(array(
	'method' => 'Actions.get',
	'period' => 'range',
	'date' => '2013-01-01,today',
	'segment' => 'customVariablePageName3==contentId;customVariablePageValue3==' . $this->accountBlogId . ';' .
				 'customVariablePageName4==contentType;customVariablePageValue4==blog' .
				 ( $mobile ? ';' . 'customVariablePageName5==mobile;customVariablePageValue5==' . (int)$mobile : '' )
));

Note: There’s a few parameters missing from there such as idSite and token_auth, but those are added within the makeRequest function.

That being said, on a page where I list numerous blog posts and their view count using the above request, the page loads quite slowly trying to access this data for each post. So I did some Googling today and started arching my Piwik stats as described here: How to Set up Auto-Archiving of Your Reports - Analytics Platform - Matomo. However, that doesn’t appear to help with the page load speed at all. Is this archive only used in the main Piwik dashboard? Do I somehow need to specify to use the archive? Does the archive not really work with custom variable searches?

Thanks!

  • Josh

you also have to pre-archive the segments that you are interested in, see in global.ini.php the section


[Segments]
; Reports with segmentation in API requests are processed in real time.
; On high traffic websites it is recommended to pre-process the data
; so that the analytics reports are always fast to load.
; You can define below the list of Segments strings
; for which all reports should be Archived during the cron execution
; All segment values MUST be URL encoded.
;Segments[]="visitorType==new"
;Segments[]="visitorType==returning"