Documentation Index
Fetch the complete documentation index at: https://docs.trygravity.ai/llms.txt
Use this file to discover all available pages before exploring further.
Flip the switch
production: true is set, the engine returns real ads matched to real campaigns, impressions and clicks count toward your revenue, and everything flows through to your dashboard.
Pre-flight checklist
Before flipping, verify each of these end-to-end in test mode:API key in your server env
GRAVITY_API_KEY set on your production host. The SDK picks it up automatically. new Gravity({ apiKey: '...' }) also works if you manage secrets differently.Ads render in every placement
For each
placement_id you request, confirm the ad shows up in the right spot in the UI. Test modes return a placeholder ad so you should always see something.Impressions fire on visibility
Scroll the ad into view. Network tab should show a request to
api.trygravity.ai/ack. Using GravityAd? That’s automatic via IntersectionObserver. Using a custom renderer? Fire new Image().src = ad.impUrl on visibility yourself.Clicks route through tracking
Click the ad. The request should go to
api.trygravity.ai/track/click first and 302 to the advertiser’s URL. Never link ad.url directly — always ad.clickUrl.Gravity pixel installed (required)
Install the Gravity pixel on your site. This is required for attribution and payouts. If you have a native app with an in-app browser, also run the in-app browser install inside your WebView.
Session IDs are stable
Every ad request from the same conversation should carry the same
sessionId. This powers frequency capping and experiment bucketing.After you flip
Check the dashboard
app.trygravity.ai → your AI platform account. Requests, impressions, clicks, and revenue all update in near-real-time.Watch fill rate
Fill rate = served / requested ads. New AI platforms often see lower fill rates for the first week as campaigns learn your audience. Raising the relevancy threshold or restricting placements can push fill up or down deliberately.
Rollback
Flipproduction: false on the constructor and deploy. You’ll immediately go back to test ads and stop accruing revenue. Nothing else changes.
What’s next
Payouts & analytics
How money moves and what the dashboard tracks.
Experiments
Let the engine optimize your creative mix automatically.