Skip to main content

React

GravityAd handles the placement design, impression and click tracking, disclosure, feedback controls, and fallback automatically. For lead-form campaigns, pass the same session ID and API key used for the ad request:
apiKey is used by the component in the browser (lead-form and feedback submissions), so it is visible to the page. Pass it down from your server with the ad response rather than referencing a server-only environment variable in client code.
The same component renders standard and lead-form ads.

Multiple placements

The response order matches the placement order in your request. Render each slot only when it fills:

Custom rendering

Use the official component unless you need a fully custom renderer. Custom renderers must:
  1. Open ad.clickUrl, not the raw landing-page URL.
  2. Request ad.impUrl exactly once when the ad becomes visible.
  3. Show a clear ad disclosure.
See the JavaScript and React SDK guide for request setup.