Impressions

Tracking impressions allows you to learn what specific users are not interested in. If the app often shows posts about football, and the user never engages with those posts, we can conclude that we’re displaying the wrong content. The code below shows how to track that a user viewed 3 specific activities:

await analytics.trackImpression(
 Impression(
  feedId: FeedId('timeline', 'tom'),
  location: 'profile_page',
  contentList: [
   Content(
    data: const {
     'foreign_id': 'post:42',
     'actor': {'id': 'user:2353540'},
     'verb': 'share',
     'object': {'id': 'song:34349698'},
    }, 
   foreignId: FeedId.id('post:42'),
   )
  ],
 ),
);

Be sure to use the same Foreign Ids as used in your feeds. This allows Stream to understand the content of the activities.

Parameters

nametypedescriptiondefaultoptional
content_listlist of strings or objectsThe list of content the user is looking at. Either a list of IDs or objects.-
feed_idstringThe feed the user is looking at.-
locationstringThe location in your app (i.e. email, homepage, profile page, etc.)-
© Getstream.io, Inc. All Rights Reserved.