The request flow
- The user sends a message. Your client calls
gravityContext()to collect the session and device data, and sends it to your server with the message. - Your server starts the ad request with
gravity.getAds()at the same time as the model call. In the SDK examples, the server streams the model response first and waits for the ad only at the end, so the ad request does not hold up the answer. - The Gravity engine compares the conversation with active campaigns, runs an auction, and returns the winning ad.
- Your server appends the ad to the stream, and your client shows it.
204 No Content (no ad), and the SDKs return an empty ads list. The SDKs also apply their own client timeout, which you can change.
Contextual matching
Gravity matches on context, not keywords.
What the engine uses:
Publishers set the relevancy threshold: a higher value shows fewer, closer matches.
How publishers earn
Publishers earn revenue on a CPM or CPC basis, depending on the campaign. The rate is not fixed. Your effective CPM (eCPM) depends on what advertisers pay for the ads you show, which Payouts and analytics explains. Gravity counts an impression when the ad’simpUrl is loaded. The SDK components load it for you once the ad is on screen (for example, the React components wait until the ad enters the viewport). If you draw ads yourself, load impUrl once when you show the ad.