trackVisibleContentImpressions
The trackVisibleContentImpressions() method enables or disables automatic tracking of content block impressions. The impression is tracked after the content block is seen by the visitor (the visitor scrolls down and sees the content).
The content block is an HTML element tagged with the data-track-content attribute or the piwikTrackContent class.
Syntax
rackVisibleContentImpressions(\[checkOnScroll[, watchInterval]])
trackVisibleContentImpressions(checkOnScroll?, watchInterval?): void
trackVisibleContentImpressions(checkOnScroll?, watchInterval?): void
trackVisibleContentImpressions(checkOnScroll?, watchInterval?): void
trackVisibleContentImpressions(checkOnScroll?, watchInterval?): void
trackVisibleContentImpressions(checkOnScroll?, watchInterval?): void
trackVisibleContentImpressions(checkOnScroll?, watchInterval?): void
Parameters
checkOnScroll (boolean, optional)
Whether to scan for a visible content block on a scroll event. Default value: true.
watchInterval (number, optional)
The delay (in milliseconds) between scans for a new visible content block. Periodic checks can be disabled by passing 0. The default value: 750.
Examples
To track impressions of a content block on scrolls with a delay of 2000 milliseconds:
_paq.push(["trackVisibleContentImpressions", true, 2000]);
trackVisibleContentImpressions(true, 2000): void
trackVisibleContentImpressions(true, 2000): void
trackVisibleContentImpressions(true, 2000): void
trackVisibleContentImpressions(true, 2000): void
trackVisibleContentImpressions(true, 2000): void
trackVisibleContentImpressions(true, 2000): void
Notes
- A content block is an HTML element tagged with the data-track-content attribute or the piwikTrackContent class.
- The parameters set in the initial setup can't be changed.
- The trackVisibleContentImpressions() won't detect content blocks placed in a scrollable element.
Related methods
Updated 6 days ago