# Google AdMob RewardedAd OnAdPaid
글의 제목과 같이 Google AdMob의 RewardedAd 사용시 OnAdPaid 호출에 대해 말하고자한다.
이런저런 이슈로 OnAdPaid 내에서 진행해야할 작업이 있다.
기본적으로 github의 예제를 충실히 따르고있고, RewardedAd 에서 제공되는 Action은 모두 등록되어있다.
당연히도 호출될 줄 알았던 OnAdPaid 함수였지만 테스트 진행중 좌절을 맛보았다.
구글 신께서 검색결과를 알려주신 하나의 이슈를 소개한다.
**Handling Android ad events in Unity**
(https://ads-developers.googleblog.com/2016/04/handling-android-ad-events-in-unity.html)
Interstitial 광고 시청 후 close 시점에 오디오 볼륨을 변경하려고했는데 동작이 잘 안된다는 글이다.
`ArgumentException: set_volume can only be called from the main thread`
그리하여 event handler 에서는 flag를 하나 두고 update 내에서 필요한 일을 하도록 변경했다는 내용이다.
이에따라 OnAdPaid 호출시도 마찬가지로 작업을 했다.
맙소사... 그런데도 꿈쩍하지를 않는다. 호출이 되지 않는다.
이번에는 Google Groups 도 뒤적거린다.
Google Mobile Ads SDK Developers
(https://groups.google.com/g/google-admob-ads-sdk)
검색어는 OnAdPaid
2024-08-06 에 등록된 글이 있다.
**Ad Impression Issue and MMP ad.OnAdPaid Event Response**
(https://groups.google.com/g/google-admob-ads-sdk/c/Aohul0JHgNA)
MMP integration 작업중인데 OnAdPaid 이벤트가 호출되지 않는다는 글이다.
Google Mobile Ads SDK Team에서 친절히 답변을 해준 기록이 있다.
테스트 환경에서 입을 실행했을때에는 OnAdPaid이 호출되지 않는다고한다.
해당 이벤트는 광고에서 수익이 창출한 것으로 추정될때만 발생한다는 이유를 설명했다.
OnAdImpressionRecorded는 광고 노출이 이뤄졌을때 발생한다고는 했으나 내가 필요한건 OnAdPaid 에서 전달되는 **AdValue** 값이다.
중간쯤에 쓰윽 설명 한줄이 있는듯 없는듯 적혀있다.
`With regard to using OnAdPaid, you may check this documentation Ad event delegates now adopt specific type arguments for an example on how to use it and also you will have to enable impression-level ad revenue Use impression-level ad revenue for OnAdPaid event to trigger.`
문서는 확인했고 `impression-level ad revenue` 를 활성화하라는것이다.
도대체 저건 무엇인고.. 하여 검색한 결과다.
**Use impression-level ad revenue**
https://support.google.com/admob/answer/11322405
한국어로는 **노출 수준 광고 수익** 이라고 불려지나보다.
`When an ad impression is shown, the Google Mobile Ads SDK sends the revenue value of the ad, the currency, and the level of precision to your app.`
상단 내용에 이렇게 설명이 되어있다.
광고가 보여지면 Google Mobile Ads SDK가 revenue value, currency, level of precision 등을 보낸다.
이 값은 내가 받고자하는 **AdValue** 값이다.
쭈욱 읽다보니 아래 부분에 뒤통수를 때리는 글이 있다.
2. Turn on the setting for impression-level ad revenue in your AdMob account:
1. Sign in to your AdMob account at https://admob.google.com .
2. Click **Settings** in the sidebar.
3. Click the **Account** tab.
4. In the Account controls section, click the **Impression-level ad revenue** toggle to turn on this setting.
AdMob에 로그인하고, 설정>계정에서 **Impression-level ad revenue** 옵션을 켜라는것이다.
망할...
**노출 수준 광고 수익** 의 값이 꺼져있었다.
제기랄..
코드 정리를하고 광고를 호출하니 드디어 OnAdPaid 가 호출된다.
길고 긴 여정이 끝났다.
---
#dev #google #admob #unity
#2025년 #2025-01
[[2025-01-06]]