sendContentImpression

The sendContentImpression() method tracks the impressions of a content block and passes data about the content name, piece, target and (optionally) the URL of the content.

Syntax

PiwikTracker.sharedInstance()?.sendContentImpression(
    name: "name",
    piece: "piece",
    target: "target",
    url: "url"
)
[[PiwikTracker sharedInstance] sendContentImpressionWithName:@"name"
                                                       piece:@"piece"
                                                      target:@"target"
                                                         url:@"url"];

Parameters

  • name string, required - The name of the tracked content block.
  • piece string, optional - The piece of the tracked content block. Example: a creative, banner or video.
  • target string, optional - The target of the tracked content block. Example: a link in the content block.
  • url string, optional - The URL of the content itself, for example the path to an image, video, audio or text resource. If not provided, the current page URL generated by the SDK is used.

Examples

To track the impression of a content block on your mobile app:

PiwikTracker.sharedInstance()?.sendContentImpression(
    name: "gravel bikes collection",
    piece: "banner",
    target: "https://example.com/bikes/",
    url: "https://example.com/banners/gravel-bikes.png"
)
[[PiwikTracker sharedInstance]
    sendContentImpressionWithName:@"gravel bikes collection"
                            piece:@"banner"
                           target:@"https://example.com/bikes/"
                              url:@"https://example.com/banners/gravel-bikes.png"];

Notes

  • Tracked impressions will be visible in Analytics > Reports > Content performance.

Related methods