Piwik seems to track queries multiple times when using content impressions. I was able to reproduce this issue using the following HTML with snippets from the documentation:
I made one request to this HTML using query parameter "test" (
index.html?q=test) which led to this visitor log in Piwik (sorry for the German wording):
The search report shows 2 visited result pages:
The database table
piwik_log_link_visit_action also has 2 entries:
select count(*) from piwik_log_link_visit_action where idvisit = 8237974; +----------+ | count(*) | +----------+ | 2 | +----------+
If I add more content blocks to the HTML, the result pages will increase appropriately.
Piwik Version is 2.12.1, PHP (unfortunately still) 5.3.10-1ubuntu3.14
Let me know if you need anything else.
Thanks for the report @helge79 - we will investigate / reproduce issue.
I just reproduced that issue. Going to find out how to fix it.
@helge79 Regarding http://developer.piwik.org/guides/content-tracking content tracking for elements with attribute
data-track-content is occured when element is displayed. So it does not matter if somebody click or not on that link, it will be tracked anyway.
So there are 2 actions in HTML:
1. Page view -
2. Content view tracking
data-track-content data-content-name="My Product Name"
Looks like it works as expected.
@mattab Am I right?
I think Content Tracking works as expected indeed :+1:
But there is still a bug, as reported above: "The search report shows 2 visited result pages" when there was only one search result page (the Content tracking request should not count as a search result page).
Maybe the problem is around Site Search archiving, ie. https://github.com/piwik/piwik/blob/2.14.1/plugins/Actions/Archiver.php#L114-118
where it could maybe also restrict the CASE statement to Actions that are Page URL, something like this:
$selectPageIsFollowingSiteSearch = ", SUM( CASE WHEN log_action_name_ref.type = " . Action::TYPE_SITE_SEARCH . " AND log_action_url.type = " . Action::TYPE_PAGE_URL . " THEN 1 ELSE 0 END) AS `" . PiwikMetrics::INDEX_PAGE_IS_FOLLOWING_SITE_SEARCH_NB_HITS . "`";