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
-
Install the package:
-
Give the ad from your Gravity ad request to
GravityAd:
React Native
-
Install the package:
-
Add
GRAVITY_RN_SPEC_OPTIONSto your ad request on the server. See Request ads. -
Give the ad to
GravityAd:
iOS
Give the ad fromgetAds() to SpecAdView:
Android
Give the ad fromgetAds() to SpecAd:
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.
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.