@theseyi opened this Issue on January 22nd 2019

May potentially be related to #6270

  • I have single page application that features a search page
  • Search results are manually using internal search tracking via trackSiteSearch
  • As per Piwik/Matomo recommendation, trackPageView is not called on the search page since trackSiteSearch is already being called
    // We recommend not to call trackPageView() on the Site Search Result page
  • I am also tracking content impressions automatically using data-attributes and initializing via a call to trackAllContentImpressions
  • Interaction tracking is handled by Piwik automatically on click, for each content block

The steps to reproduce this issue

  • Perform a search query
    • the content impression should now be tracked for the items in the search result
    • trackSiteSearch is called
  • Click on the trackable content in search result
    • on page transition, the interaction is tracked
  • Navigate back to the Search results page by clicking the back button in the browser
    • the content impression is not tracked for the items in the result
    • click the trackable content in search result
    • on page transition, the interaction is tracked

The above steps will result in more content interactions than content impressions for the content block that is interacted with.

I believe the issue emanates from the fact that on back navigation, all content impressions are not registered in Piwik even though a call is made via trackAllContentImpressions, because a call to trackPageView is not made to force Piwik to register the impressions?

As per Content Tracking section:

We won't send an impression of the same content block twice if you call this method multiple times unless trackPageView() is called meanwhile. This is useful for single page applications.


After a bit of further investigation, it does not seem that failure to call trackPageView is the cause of this issue. Manually, adding a call to trackPageView still allowed reproduction of the issue

@theseyi commented on January 22nd 2019

Adding an image if it helps visualize the issue:
@tsteur @mattab

@tsteur commented on January 22nd 2019 Member

I had a quick look in the code... while impressions may be only tracked once within a pageview, an interaction may be tracked multiple times from what I see. Basically what you want would be maybe "Unique Impressions" and "Unique interactions"?
See https://github.com/matomo-org/matomo/issues/6272 where I explained behaviour.

Also in the code I'm seeing that an interaction could be tracked without an impression being tracked I think. See https://github.com/matomo-org/matomo/issues/6270

@theseyi commented on January 22nd 2019

Thanks for taking a look @tsteur . I think a primary issue here is when i navigate back to the page containing content impressions, and trackAllContentImpressions is invoked via


, this new call is not reflected in Piwik. i.e. the impressions count is not incremented.

However, clicking on any content block immediately increments the count for that content block's interactions

  • Is there any reason why a manual / direct call to trackAllContentImpressions will be ignored even after trackSiteSearch?
  • I would assume the direct call should be respected?
@tsteur commented on January 23rd 2019 Member

created https://github.com/matomo-org/matomo/pull/14002 re trackSiteSearch 👍

This Issue was closed on April 8th 2019
Powered by GitHub Issue Mirror