Track Views
Mark posts as viewed and collect impression data
Analyze Reach
Monitor unique user engagement and content reach
User Insights
Query detailed information about who viewed your posts
Impressions represent the total number of times a post has been viewed, while reach represents the number of unique users who have viewed the post. Post impression data is updated in near real-time for optimal performance.
Analytics Metrics
Impression tracking provides essential metrics for content performance analysis and user engagement insights.Metric | Description | Use Case |
---|---|---|
Impressions | Total number of times a post has been viewed | Track overall content visibility and exposure |
Reach | Number of unique users who viewed the post | Measure audience size and content distribution |
View Rate | Percentage of users who viewed vs. total followers | Assess content relevance and engagement quality |
Marking Posts as Viewed
Track user interactions by marking posts as viewed when they appear in the user’s feed or are specifically opened.Implementation
1
Detect View Event
Determine when a post should be considered “viewed” (e.g., visible in feed, opened in detail).
2
Mark as Viewed
Call the analytics method to record the impression.
3
Access Metrics
Retrieve updated impression and reach counts from the post object.
4
Update UI
Display analytics data in your interface.
Query Reached Users
Retrieve detailed information about which users have viewed specific posts to gain insights into your audience and content performance.Parameters
Parameter | Type | Required | Description |
---|---|---|---|
viewedType | AmityViewedType | Yes | Type of content viewed (use .post for posts) |
viewedId | String | Yes | ID of the post to query reached users for |
Best Practices
Performance Optimization
Performance Optimization
- Debounce View Events: Prevent multiple impressions from rapid scrolling
- Batch Analytics Calls: Group multiple post views for efficient API usage
- Cache Analytics Data: Store impression counts locally to reduce API calls
- Background Processing: Handle analytics operations asynchronously
- Memory Management: Properly dispose of observation tokens
User Experience
User Experience
- Non-blocking Operations: Don’t let analytics calls slow down the UI
- Privacy Considerations: Respect user privacy when tracking view data
- Graceful Degradation: Handle analytics failures without affecting core functionality
Data Accuracy
Data Accuracy
- View Threshold: Define minimum view time before marking as viewed
- Unique Tracking: Ensure each user is counted only once per post
- Validation: Verify analytics data integrity before displaying
Analytics Strategy
Analytics Strategy
- Meaningful Metrics: Focus on metrics that drive business decisions
- Trend Analysis: Track changes over time rather than absolute numbers
- Segmentation: Analyze performance by user groups or content types
- A/B Testing: Use analytics to validate content strategy changes
Troubleshooting
Impressions not updating
Impressions not updating
- Verify that
markAsViewed()
is being called correctly - Check network connectivity for analytics data sync
- Ensure user has proper permissions to view the post
- Test with different posts to isolate the issue
Reached users query failing
Reached users query failing
- Confirm post exists and is accessible
- Check if the post has any actual impressions
- Test with posts that have known viewers
Analytics data inconsistency
Analytics data inconsistency
- Allow time for near real-time updates to propagate
- Check if users are being counted multiple times
- Verify that view tracking is working across different entry points
- Review analytics implementation for race conditions
Practical Examples
Content Analytics Dashboard
Build comprehensive dashboards showing post performance, reach trends, and audience insights for content creators.
Audience Insights
Analyze user demographics and engagement patterns to better understand your community audience and optimize content strategy.
A/B Testing Framework
Compare impression rates between different post formats, content types, or posting times to optimize engagement.
Engagement Scoring
Calculate post engagement scores based on reach, impressions, and user interaction patterns for content ranking.