Accessing complete site analytics

Hi, I’m planing on running a website to do a/b testing, and I’m having the following issue

I need to show information of several sites at the same time in a dashboard that just show visits, unique visits, conversion, unique conversions. This values are total values, from the moment the site_id was created on.

Up to a while I had the following query that worked pretty well

			$visits_sql = "SELECT cv.count_visits, cuv.count_unique_visits, cc.count_conversion, cuc.count_unique_conversion FROM
			(SELECT count(*) as count_visits FROM piwik_log_link_visit_action
			WHERE idsite = ".$item->piwik_site_id.") as cv,
			(SELECT count(*) as count_unique_visits FROM
			(SELECT * FROM piwik_log_link_visit_action GROUP BY idvisitor) as temp
			WHERE idsite = ".$item->piwik_site_id.") as cuv,
			(SELECT count(*) as count_conversion FROM piwik_log_conversion
			WHERE idsite = ".$item->piwik_site_id.") as cc,
			(SELECT count(*) as count_unique_conversion FROM
			(SELECT * FROM piwik_log_conversion GROUP BY idvisitor) as temp
			WHERE idsite = ".$item->piwik_site_id.") as cuc";

I suspect that I could make it better, but it runs pretty smooth.

So I started looking at the api for another reason and I figured out that if the logs are archived it should be faster than doing my own sql query, but right now the api is quite a lot slower! I’ve tried with api.get with periods of last 3 years and for +20 websites it can take more than 30s in complete the query.

Is it appropriated to use the api for this type of query? maybe is looking for a lot more information that the one I need and thats slowing me down.

Also, does my current query going to get slow when I pick up visitors?

My regards


We have released a plugin that works on top of Piwik to run A/B Tests, Split Tests, Experiments see . A full list of features is mentioned on the Marketplace at

It lets you easily run experiments on websites, servers, apps and in campaigns and has lots of features to customize your experiment and to define your success and your expectations for an experiment to increases your sales, revenue, conversions, pageviews, and more.

More docs are available at: User Guides, FAQ, Developer docs