trackContentInteraction
The trackContentInteraction() method tracks interactions with 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
trackContentInteraction(contentInteraction, contentName, contentPiece, contentTarget)
trackContentInteraction(contentInteraction, contentName, contentPiece, contentTarget): void
trackContentInteraction(contentInteraction, contentName, contentPiece, contentTarget): void
trackContentInteraction(contentInteraction, contentName, contentPiece, contentTarget): void
trackContentInteraction(contentInteraction, contentName, contentPiece, contentTarget): void
trackContentInteraction(contentInteraction, contentName, contentPiece, contentTarget): void
trackContentInteraction(contentInteraction, contentName, contentPiece, contentTarget): void
Parameters
contentInteraction (string, required)
The type of interaction with the tracked content block. Example: click.
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 interaction with a content block on a page (along with a content impression):
_paq.push([
"trackContentImpression",
"bike-jump-video",
"https://example.com/big-jump.mp4",
"https://example.com/bikes/",
]);
_paq.push([
"trackContentInteraction",
"click",
"bike-jump-video",
"https://example.com/big-jump.mp4",
"https://example.com/bikes/",
]);
trackContentInteraction("trackContentInteraction", "click", "bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): void
trackContentInteraction("trackContentInteraction", "click", "bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): void
trackContentInteraction("trackContentInteraction", "click", "bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): void
trackContentInteraction("trackContentInteraction", "click", "bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): void
trackContentInteraction("trackContentInteraction", "click", "bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): void
trackContentInteraction("trackContentInteraction", "click", "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.
- Always call the trackContentInteraction() method along with the trackContentImpression() method. This will help you keep the tracking consistent.
Related methods
Updated 6 days ago