Type [String][api.type.string] Event adsRequest Revision Release 2026.3728 Keywords ads, advertising, AdMob, adsRequest, data See also adsRequest admob.*
A
adUnitId — The AdMob ad unit ID that generated the event.rewardItem — The reward item name as defined in the AdMob dashboard. This is only available when event.phase is "reward".rewardAmount — The reward item amount as defined in the AdMob dashboard. This is only available when event.phase is "reward".adValue — The estimated revenue value for the ad impression in standard currency units "0.005" means $0.005)"revenue".currencyCode — The ISO 4217 currency code for the revenue value "USD")"revenue".precision — The precision type of the reported revenue value. Possible values are 0 (unknown), 1 (estimated), 2 (publisher provided), and 3 (precise). This is only available when event.phase is "revenue". See Precision Types below for details.errorCode — The error code for the event that failed. This is only available when event.phase is "failed".errorMsg — An error message with the reason for the failure. This is only available when event.phase is "failed".The precision field indicates the accuracy of the reported adValue:
| Value | Name | Description |
|---|---|---|
0 |
Unknown | The value is not known. Returned for test ads. |
1 |
Estimated | An estimate based on median eCPM from the ad network or mediation group. Most common in production. |
2 |
Publisher Provided | A manually configured CPM value from mediation group settings. |
3 |
Precise | Exact revenue reported by the ad network. Only some networks support this. |
local json = require("json")
local function adListener( event )
if ( event.phase == "revenue" ) then
local data = json.decode( event.data )
-- Revenue data
print( data.adUnitId ) -- "ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY"
print( data.adValue ) -- "0.005"
print( data.currencyCode ) -- "USD"
print( data.precision ) -- 1
elseif ( event.phase == "reward" ) then
local data = json.decode( event.data )
-- Reward data
print( data.rewardItem ) -- "coins"
print( data.rewardAmount ) -- 100
elseif ( event.phase == "failed" ) then
local data = json.decode( event.data )
-- Error data
print( data.errorCode ) -- e.g. 3
print( data.errorMsg ) -- e.g. "No fill"
end
end