Rewarded Ad - what event to use to give reward to the user? (Unity)

809 views
Skip to first unread message

Victor Moldoveanu

unread,
Mar 29, 2023, 4:19:30 AM3/29/23
to Google Mobile Ads SDK Developers
Hi, I've just updated to the latest release for unity (7.4.1) and I'm upgrading my old code (6.something) to fit the new update. 

I have implemented the rewarded ad but it is not clear to me which event to use to give the reward to the user.

old code used to trigger reward for user
rewardedAd.OnUserEarnedReward += HandleUserEarnedReward
for this I get the suggestion to use new OnAdPaid event

new code that does not work
ad.OnAdImpressionRecorded += () => {    }; 
ad.OnAdPaid += (AdValue adValue) =>  {   StartCoroutine(RewardedUserReward());   };

new code that works
ad.OnAdImpressionRecorded += () => {   StartCoroutine(RewardedUserReward());   }; 
ad.OnAdPaid += (AdValue adValue) =>  {    };

//RewardUserReward is similar to old HandleUserEarnedReward

I am running the code locally on the PC with dummy ads. 

If i put the reward method in OnAdImpressionRecorded, everything works fine. If i put it in OnAdPaid then I get no reward, the event is not even triggered in debugging mode. 

So which one is the correct approach?
the "recommended" OnAdPaid that does not work or the other one that works?

Thanks,
- Victor

Victor Moldoveanu

unread,
Mar 29, 2023, 8:24:21 AM3/29/23
to Google Mobile Ads SDK Developers
I've tested this also on an Internal Test track version of the game and the results is the same.

Mobile Ads SDK Forum Advisor

unread,
Mar 29, 2023, 10:11:04 AM3/29/23
to victor.m...@gmail.com, google-adm...@googlegroups.com

Hello Victor,
 

Thank you for reaching out to us.
 

The reason why OnAdPaid event is not working in the testing environment is because its only raised when the ad is estimated to have earned money. As for OnAdImpressionRecorded, its raised when an impression is recorded for an ad. But with regards to your concern, the recommended method is when showing the rewarded interstitial ad with reward callback. Specifically in the rewardedInterstitialAd.Show((Reward reward) method.

rewardedInterstitialAd.Show((Reward reward) =>
        {
            // TODO: Reward the user.
            Debug.Log(String.Format(rewardMsg, reward.Type, reward.Amount));
        });


The rewarded interstitial ad events you've mentioned may also be used for rewarding the user but it primarily depends on your implementation.

Regards,

Google Logo Mobile Ads SDK Team


ref:_00D1U1174p._5004Q2jpQi6:ref

Victor Moldoveanu

unread,
Mar 29, 2023, 10:18:32 AM3/29/23
to Mobile Ads SDK Forum Advisor, google-adm...@googlegroups.com
oh, ok, got it! so rewarding the user goes into the Show method. Thanks for clarifying!

wwforever_nw

unread,
Jun 29, 2023, 4:28:02 AM6/29/23
to Google Mobile Ads SDK Developers
Same issue occurs.
I wonder if advertising revenue occurred when using the Show method.
OnAdPaid is used instead of OnUserEarnedReward, but it seems strange to reward the user unconditionally even though no callback has occurred.
The OnAdPaid event is triggered when the ad is estimated to generate revenue, and I want to give a reward only at this time.
Finally, OnAdPaid works for test ads. Rather, it doesn't happen with formal ads.

2023년 3월 29일 수요일 오후 11시 18분 32초 UTC+9에 Victor Moldoveanu님이 작성:

Mobile Ads SDK Forum Advisor

unread,
Jun 29, 2023, 12:47:27 PM6/29/23
to wwfo...@neowiz.com, google-adm...@googlegroups.com

Hi,

Thank you for reaching out to us.

With regard to using OnAdPaid, you may check this documentation (https://developers.google.com/admob/unity/migration#ad_event_delegates_now_adopt_specific_type_arguments) for an example on how to use it. If you encounter any error in your implementation, just kindly let us know, and if this is not what you're looking for, kindly elaborate your concern so we can provide proper guidance.

This message is in relation to case "ref:_00D1U1174p._5004Q2jpQi6:ref"

Thanks,

 
Google Logo Mobile Ads SDK Team

 



Reply all
Reply to author
Forward
0 new messages