Rewarded ads use the Hook API. useRewardedAd manages loading state and reward callbacks together inside your component.
The previous static API (RewardedAd.loadAd and friends) is deprecated. Static listeners such as RewardedAd.addAdLoadedEventListener do not receive events for ads loaded through the Hook or instance API — when you move ad loading to the new API, move the event listeners with it.
The code below shows how to tag your internal User ID and pass CustomData to the callback.
The User ID string can be up to 8192 characters.
setUserId("${USER_ID}");// Pass CustomData to the show function returned by useRewardedAd.const { isLoaded, show } = useRewardedAd(REWARDED_AD_UNIT_ID);if (isLoaded) { show("CUSTOM_DATA");}
Assistant
Responses are generated using AI and may contain mistakes.