SDK v7.x · Last verified March 2026 · iOS · Android · Web · Flutter
Speed run — just the code
Speed run — just the code
Prerequisites: SDK installed and authenticated → SDK Setup. Ads must be configured in Admin Console → Settings → Premium Ads with at least one active creative uploaded.Also recommended: Complete Build a Social Feed first — ads render inline within feed content.
After completing this guide you’ll have:
- Native ad units rendering in the feed at configured intervals
- Impression and click events tracked and sent to the Admin Console
- Ad frequency and targeting rules configured via the Admin Console
Quick Start: Fetch and Display Ads
TypeScript
Step-by-Step Implementation
Fetch ads and placement settings
Call Full reference → Ads
getNetworkAds() on app launch and cache the result. The response includes the ad creatives (images, text, CTAs) and settings that define where and how often to show them.TypeScript
Insert ads into the feed
Use the placement settings to insert ad cards at the right intervals in your social feed. A common pattern is to insert an ad every N posts.
TypeScript
Track impressions
When an ad enters the viewport, mark it as seen. This records an impression for analytics. Use an Intersection Observer (web) or equivalent visibility detection on mobile.Full reference → Ads
TypeScript
Track link clicks
When a user taps an ad’s call-to-action, record the click before opening the destination URL.Full reference → Ads
TypeScript
Configure ads in the Admin Console
Set up ad creatives, targeting, and placement rules in Admin Console → Settings → Premium Ads:
- Creative: Upload ad image/video, set headline text and CTA button text
- Targeting: Choose which communities or content categories to show the ad in
- Frequency: How often ads appear in the feed (every N posts)
- Schedule: Start/end dates for the campaign
Connect to Moderation & Analytics
Ad performance analytics
Ad performance analytics
View impression counts, click-through rates, and conversion metrics per ad creative in Admin Console → Analytics → Ads Performance. Use this to optimize creative and placement.
Ad moderation
Ad moderation
Community moderators can flag ads that don’t fit their community’s tone. Flagged ads are reviewed in the Admin Console moderation queue.
Webhook: ad events
Webhook: ad events
Receive ad impression and click events via webhooks to sync with your ad server or analytics pipeline.→ Webhook Events
Common Mistakes
Best Practices
Ad placement UX
Ad placement UX
- Don’t show ads in the first 3 positions of the feed — let users see content first
- Match the ad card styling to your post card styling for a native feel
- Label ads clearly with an “Ad” or “Sponsored” tag — transparency builds trust
- Don’t show more than 1 ad per 5 posts — higher density drives users away
- Hide ads from the feed when ad count is 0 — never show a broken ad placeholder
Impression accuracy
Impression accuracy
- Only call
markAsSeen()when the ad is at least 50% visible for 1+ seconds — this matches industry standards - Don’t track impressions when the app is backgrounded or the screen is off
- De-duplicate impressions client-side — only track the first impression per ad per session
- Use
Amity.AdPlacement.FEEDfor in-feed ads and the appropriate placement enum for other positions
Performance
Performance
- Cache
getNetworkAds()for the session — ads change infrequently - Pre-load ad images while the user is scrolling through content
- Lazy-load ad video creatives — only start playback when the ad is in view
- Keep ad card rendering lightweight — heavy ad views slow down feed scrolling
Next Steps
Your next step → Post Impressions & Creator Analytics
Ads are running — now track organic content performance alongside ad metrics.
Build a Social Feed
Build the feed where ads are placed
Stories & Ephemeral Content
Integrate sponsored stories alongside user stories
Content Moderation Pipeline
Handle flagged ad content