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): voidtrackContentInteraction(contentInteraction, contentName, contentPiece, contentTarget): voidtrackContentInteraction(contentInteraction, contentName, contentPiece, contentTarget): voidtrackContentInteraction(contentInteraction, contentName, contentPiece, contentTarget): voidtrackContentInteraction(contentInteraction, contentName, contentPiece, contentTarget): voidtrackContentInteraction(contentInteraction, contentName, contentPiece, contentTarget): voidParameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| contentInteraction | string | The type of interaction with the tracked content block. Example: "click". | Yes |
| 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 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/"): voidtrackContentInteraction("trackContentInteraction", "click", "bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): voidtrackContentInteraction("trackContentInteraction", "click", "bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): voidtrackContentInteraction("trackContentInteraction", "click", "bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): voidtrackContentInteraction("trackContentInteraction", "click", "bike-jump-video", "https://example.com/big-jump.mp4", "https://example.com/bikes/"): voidtrackContentInteraction("trackContentInteraction", "click", "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.
- Always call the trackContentInteraction() method along with the trackContentImpression() method. This will help you keep the tracking consistent.
Related methods
Updated 15 days ago