Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Tracking: Interactions count greater than impressions count #13988

Closed
theseyi opened this issue Jan 22, 2019 · 4 comments · Fixed by #14002
Closed

Content Tracking: Interactions count greater than impressions count #13988

theseyi opened this issue Jan 22, 2019 · 4 comments · Fixed by #14002
Labels
Bug For errors / faults / flaws / inconsistencies etc.

Comments

@theseyi
Copy link

theseyi commented Jan 22, 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.

EDIT:

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 theseyi changed the title Content Tracking: Interactions greater than impressions when trackPageView not called Content Tracking: Interactions count greater than impressions count Jan 22, 2019
@theseyi
Copy link
Author

theseyi commented Jan 22, 2019

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

@tsteur
Copy link
Member

tsteur commented Jan 22, 2019

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 #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 #6270

@theseyi
Copy link
Author

theseyi commented Jan 22, 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

_paq.push(['trackAllContentImpressions'])

, 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
Copy link
Member

tsteur commented Jan 23, 2019

created #14002 re trackSiteSearch 👍

@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Jun 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
3 participants