Skip to main content
A server-rendered design is a layout for a placement that Gravity sends with the ad, in the renderer_spec field. The official SDK components draw it. Gravity can change the design of a placement with no code change and no SDK upgrade in your app. You install the SDK and add the ad component.

React

  1. Install the package:
  2. Give the ad from your Gravity ad request to GravityAd:
For the request setup, see the JavaScript and React SDK guide.

React Native

  1. Install the package:
  2. Add GRAVITY_RN_SPEC_OPTIONS to your ad request on the server. See Request ads.
  3. Give the ad to GravityAd:
For the request setup and for ads in lists, see the React Native SDK guide.

iOS

Give the ad from getAds() to SpecAdView:
For the installation and the request setup, see the iOS SDK guide.

Android

Give the ad from getAds() to SpecAd:
For the installation and the request setup, see the Android SDK guide.

What the SDKs do for you

The official SDK components:
  • Draw the server-rendered design when it is compatible with the client.
  • Show a built-in card when no valid design is available.
  • Record impressions and clicks.
  • Show the required ad label.
  • Support light and dark themes.
  • Show feedback buttons (iOS and Android only). See Ad feedback.
A custom design changes only how the ad looks. Tracking, attribution, and billing use the same URLs from the ad response.

Image ads

When an ad has a product image, Gravity sends an image card layout with it. The image card shows the image on one side and the text on the other side. These SDK versions draw it with no code change: @gravity-ai/react 1.3.0, @gravity-ai/ui 0.3.0, and @gravity-ai/react-native 0.2.0, and later versions. Older versions show the text card. Ads without an image always use the text card. To see an image ad, send a test request with testAdFormat: "image". See Image ads.

Custom placement design

To get a custom design for a placement, send your placement ID and the look you want to support@trygravity.com. Gravity sets up and checks the design before it goes live.