@tsteur opened this Issue on August 28th 2015 Owner

This is related to https://github.com/piwik/piwik/issues/6270 which is about making sure to track an impression was tracked when tracking an interaction.

When tracking a content interaction, it will be only shown in the UI or reports if there was also a content impression tracked having the exact same content name, content target and content piece.

This is usually not a problem as piwik.js will only track an interaction if we did detect an impression (and therefore tracked it). For example trackAllContentImpressions will detect all content blocks on a page and track an impression for them. This method also sets up the event listeners for content interactions. As piwik.js handles the impression tracking and event listener setup we make sure to track an impression and interaction with the same values.

There are some edge cases though. Eg when using trackVisibleContentImpressions we only track content blocks that were actually in the view part. There's a chance that we did not detect correctly an impression when it came into the view port but the user clicks on it meaning we track an interaction but no impression. A possible fix for this would be #6270. It is mainly a problem if one calls trackContentInteraction or trackContentInteractionNode() manually and forgets to call trackContentImpression or trackContentImpressionsWithinNode as well or calls those methods with different values.

I think we should develop both https://github.com/piwik/piwik/issues/6270 and this. I see this issue as a "safety net" to get notified in case there are edge cases etc. It is otherwise very hard to detect why a content impression is not shown in the reports.

From a technical point of view we should save all tracked content impressions in an array and when tracking a content interaction, loop over these impressions and if no impression having the same content name, piece and target was found, trigger a console.error (if console API is available)

Powered by GitHub Issue Mirror