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

ParameterTypeDescriptionRequired
contentInteractionstringThe type of interaction with the tracked content block. Example: "click".Yes
contentNamestringThe name of the tracked content block.Yes
contentPiecestringThe piece of the tracked content block. Example: a creative, banner or video.Yes
contentTargetstringThe 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/"): 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