Endpoints
Ad Feedback
Let users react to ads with thumbs-up / thumbs-down.
POST
End users can submit feedback on served ads — thumbs up, thumbs down, and optional reasons. This helps Gravity improve ad quality and relevancy over time, and gives publishers a signal for user satisfaction.
Just pass through
Every ad response includes an
Base URL
Headers
string
required
Your Gravity publisher API key.
Body
string
required
Session identifier. Same value you passed when requesting the ad.
string
required
The
impUrl from the ad response object. The server decrypts this to extract the ad’s tracking IDs (grclid, gradid, campaignId, publisherId) automatically — you don’t need to parse or extract anything yourself.string
required
User’s reaction. One of
thumbs_up or thumbs_down.array
Optional. Why the user reacted this way. Array of reason strings. Suggested values:
You can send any string — the values above are suggestions, not an enum.
string
Optional. Free-text feedback from the user (max 1,000 characters).
string
Optional. Placement type where the ad was shown (e.g.
below_response).string
Optional. Publisher’s slot identifier for the placement.
string
Optional. Publisher’s end-user identifier.
object
Optional. Device signals — same shape as the ad request’s
device object.Response
200 — feedback recorded.
401 — invalid API key.
422 — invalid impUrl. The URL could not be decrypted. Make sure you’re sending the exact impUrl from the ad response.
429 — rate limit exceeded. The endpoint allows up to 30 feedback submissions per session per minute.
503 — internal error. Safe to retry.
Server-prompted feedback
Official Gravity SDKs show and submit feedback controls automatically when requested by the server. No publisher setup is required. Custom renderers can usefeedbackPrompt to decide when to show controls and POST the response to this endpoint. Feedback interactions must not count as ad clicks.
Best practices
Surface feedback controls after the ad renders
Show a small thumbs-up / thumbs-down UI once the ad is visible. Don’t interrupt the user — feedback should be one tap, not a modal.Collect reasons on thumbs-down
When a user taps thumbs-down, show a quick follow-up with checkboxes or chips fornot_interested, irrelevant, repetitive, offensive. Send the selected reasons in the reasons array. This gives Gravity actionable signal to improve matching.
Don’t gate the experience on feedback
Feedback is fire-and-forget. If the request fails, swallow the error — never block the user’s workflow because a feedback call didn’t land.Just pass through impUrl
Every ad response includes an impUrl. Simply store the ad object and pass ad.impUrl back when submitting feedback — the server handles all the tracking ID extraction automatically. No need to parse URLs or decrypt tokens on the client side.
What’s next
Show ads
Render ads with the pre-built React component or your own UI.
Contextual ads endpoint
Full request / response reference for
POST /api/v1/ad.
