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): voidtrackContentImpression(contentName, contentPiece, contentTarget): voidtrackContentImpression(contentName, contentPiece, contentTarget): voidtrackContentImpression(contentName, contentPiece, contentTarget): voidtrackContentImpression(contentName, contentPiece, contentTarget): voidtrackContentImpression(contentName, contentPiece, contentTarget): voidParameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| contentName | string | The name of the tracked content block. | Yes |
| contentPiece | string | The piece of the tracked content block. Example: a creative, banner or video. | Yes |
| contentTarget | string | The target of the tracked content block. Example: a link in a content block. | Yes |
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/"): voidtrackContentImpression("bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): voidtrackContentImpression("bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): voidtrackContentImpression("bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): voidtrackContentImpression("bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): voidtrackContentImpression("bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): voidNotes
- 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 15 days ago