trackContentImpression
The trackContentImpression() method tracks the impressions of a content block and passes data about the content name, piece and target. The content block is an HTML element tagged with the data-track-content attribute or the piwikTrackContent class.
Syntax
trackContentImpression(contentName, contentPiece, contentTarget)
trackContentImpression(contentName, contentPiece, contentTarget): void
trackContentImpression(contentName, contentPiece, contentTarget): void
trackContentImpression(contentName, contentPiece, contentTarget): void
trackContentImpression(contentName, contentPiece, contentTarget): void
trackContentImpression(contentName, contentPiece, contentTarget): void
trackContentImpression(contentName, contentPiece, contentTarget): void
Parameters
contentName (string, required)
The name of the tracked content block.
contentPiece (string, required)
The piece of the tracked content block. Example: a creative, banner or video.
contentTarget (string, required)
The target of the tracked content block. Example: a link in a content block.
Example
To track the impression of a content block on a page:
_paq.push([
"trackContentImpression",
"bike-jump-video",
"https://example.com/big-jump.mp4",
"https://example.com/bikes/",
]);
trackContentImpression("bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): void
trackContentImpression("bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): void
trackContentImpression("bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): void
trackContentImpression("bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): void
trackContentImpression("bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): void
trackContentImpression("bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): void
Notes
- A content block is an HTML element tagged with the data-track-content attribute or the piwikTrackContent class.
Related methods
- trackAllContentImpressions()
- trackVisibleContentImpressions()
- trackContentImpressionsWithinNode()
- logAllContentBlocksOnPage()
- trackContentInteractionNode()
- trackContentInteraction()
Updated 6 days ago