trackContentImpressionsWithinNode

The trackContentImpressionsWithinNode() method tracks impressions of a content block in the DOM Node and its children. The content block is an HTML element tagged with the data-track-content attribute or the piwikTrackContent class.

Syntax

trackContentImpressionsWithinNode(domNode)
trackContentImpressionsWithinNode(domNode): void
trackContentImpressionsWithinNode(domNode): void
trackContentImpressionsWithinNode(domNode): void
trackContentImpressionsWithinNode(domNode): void
trackContentImpressionsWithinNode(domNode): void
trackContentImpressionsWithinNode(domNode): void

Parameters

domNode (node, required)

The DOM Node that contains content blocks.

Examples

To track the impressions of a content block in the DOM Node:

trackContentImpressionsWithinNode(domNode)
var element = document.querySelector("#impressionContainer");  
_paq.push(["trackContentImpressionsWithinNode", element]);
var element = document.querySelector("#impressionContainer");  
_paq.push(["trackContentImpressionsWithinNode", element]);
var element = document.querySelector("#impressionContainer");  
_paq.push(["trackContentImpressionsWithinNode", element]);
var element = document.querySelector("#impressionContainer");  
_paq.push(["trackContentImpressionsWithinNode", element]);
var element = document.querySelector("#impressionContainer");  
_paq.push(["trackContentImpressionsWithinNode", element]);
var element = document.querySelector("#impressionContainer");  
_paq.push(["trackContentImpressionsWithinNode", element]);

Notes

  • A content block is an HTML element tagged with the data-track-content attribute or the piwikTrackContent class.
  • This method can be used with the trackVisibleContentImpressions() method to track only visible content impressions.

Related methods