각 광고 형식에는 OnPaidEvent 이벤트가 있습니다. 광고 이벤트의 수명 주기 동안 Google 모바일 광고 SDK가 노출 이벤트를 모니터링하고 획득한 값으로 핸들러를 호출합니다.
아래 코드는 보상형 광고의 유료 이벤트를 처리하는 방법을 보여줍니다.
RewardedAdrewardedAd;privatevoidRequestRewardedAd(){rewardedAd=newRewardedAd("AD_UNIT_ID");rewardedAd.OnPaidEvent+=this.HandleAdPaidEvent;AdRequestadRequest=newAdRequest();rewardedAd.LoadAd(adRequest);}publicvoidHandleAdPaidEvent(objectsender,AdValueEventArgsargs){// TODO: Send the impression-level ad revenue information to your// preferred analytics server directly within this callback.AdValueadValue=args.AdValue;longvalueMicros=adValue.Value;stringcurrencyCode=adValue.CurrencyCode;PrecisionTypeprecision=adValue.Precision;ResponseInforesponseInfo=rewardedAd.GetResponseInfo();stringresponseId=responseInfo.GetResponseId();AdapterResponseInfoloadedAdapterResponseInfo=responseInfo.GetLoadedAdapterResponseInfo();stringadSourceId=loadedAdapterResponseInfo.AdSourceId;stringadSourceInstanceId=loadedAdapterResponseInfo.AdSourceInstanceId;stringadSourceInstanceName=loadedAdapterResponseInfo.AdSourceInstanceName;stringadSourceName=loadedAdapterResponseInfo.AdSourceName;stringadapterClassName=loadedAdapterResponseInfo.AdapterClassName;longlatencyMillis=loadedAdapterResponseInfo.LatencyMillis;Dictionary<string,string>credentials=loadedAdapterResponseInfo.AdUnitMapping;Dictionary<string,string>extras=responseInfo.GetResponseExtras();stringmediationGroupName=extras["mediation_group_name"];stringmediationABTestName=extras["mediation_ab_test_name"];stringmediationABTestVariant=extras["mediation_ab_test_variant"];}
광고 객체를 만들거나 광고 객체에 액세스할 수 있게 되면 즉시 OnPaidEvent 이벤트를 설정하세요. 광고 게재 전에 설정해야 합니다. 이렇게 하면 콜백이 누락되지 않습니다.
노출 수준 광고 수익 정보를 OnPaidEvent 핸들러에서 원하는 분석 서버로 즉시 전송하세요. 이렇게 하면 의도치 않은 콜백 누락이 발생하지 않으며, 데이터 불일치를 방지할 수 있습니다.
AdValue
AdValue는 광고에서 획득한 금전적 가치를 나타내는 클래스입니다(예: 값의 통화 코드, 아래와 같이 인코딩된 정밀도 유형).
AdValue.PrecisionType
설명
Unknown
광고 값을 알 수 없습니다. LTV 핑백이 사용 설정되었지만 사용 가능한 데이터가 충분하지 않은 경우 반환됩니다.
Estimated
합산 데이터에서 예상되는 광고 값입니다.
PublisherProvided
미디에이션 그룹의 수동 CPM처럼 게시자가 제공한 광고 값입니다.
Precise
이 광고의 정확한 값입니다.
미디에이션의 경우, Ad Manager는 자동 데이터 수집이 사용 설정된 광고 소스에 대한 ESTIMATED 값을
제공합니다. 자세한 내용은
자동 데이터 수집을 참고하세요. 자동 데이터 수집이
사용 설정되지 않은 광고 소스의 경우
또는 의미 있는 추정치를 보고할 만큼 충분한 합산 데이터가 없는 경우
PUBLISHER_PROVIDED 값이 반환됩니다.
공개 입찰의 노출 테스트
테스트 요청을 통해
공개 입찰 광고 소스에
노출 수준 광고 수익 이벤트가 발생하면
다음 값만 수신됩니다.
Unknown: 정밀도 유형을 나타냅니다.
0: 광고 값을 나타냅니다.
이전에는 정밀도 유형이
Unknown이 아닌 값으로 표시되고 광고 값이
0보다 큰 값으로 표시되었을 수 있습니다.
[null,null,["최종 업데이트: 2025-09-02(UTC)"],[[["\u003cp\u003eThe Google Mobile Ads SDK provides impression-level ad revenue data that can be used to calculate user lifetime value or for other analytics purposes.\u003c/p\u003e\n"],["\u003cp\u003eTo implement this, ensure you've enabled the feature in Ad Manager, are using Unity plugin 5.0.0 or higher, have completed the Get Started guide, and have implemented at least one ad format.\u003c/p\u003e\n"],["\u003cp\u003eYou need to implement an \u003ccode\u003eOnPaidEvent\u003c/code\u003e handler for each ad format to capture the ad revenue data which is provided as an \u003ccode\u003eAdValue\u003c/code\u003e object containing currency, value (in micros), and precision type.\u003c/p\u003e\n"],["\u003cp\u003eFor integrations with analytics platforms like Adjust, AppsFlyer, Singular, and Tenjin, refer to their respective partner guides.\u003c/p\u003e\n"],["\u003cp\u003eIt is recommended to set the \u003ccode\u003eOnPaidEvent\u003c/code\u003e handler immediately upon ad object creation and to send the data to your analytics server directly within the handler to prevent data loss.\u003c/p\u003e\n"]]],[],null,["When an impression occurs, the Google Mobile Ads SDK provides ad revenue data\nassociated with that impression. You can use the data to calculate a user's\nlifetime value, or forward the data downstream to other relevant systems.\n\nThis guide is intended to help you implement the impression-level ad revenue\ndata capture in your Unity project.\n\nPrerequisites\n\n- Make sure you have [turned on the impression-level ad revenue\n feature](//support.google.com/admanager/answer/13404416) in the Ad Manager UI.\n- Unity plugin 5.0.0 or higher.\n- Complete [Get Started](/ad-manager/mobile-ads-sdk/unity/quick-start). Your Unity app should already have the Google Mobile Ads Unity plugin imported.\n- Before you can receive any impression-level ad revenue data, you need to\n implement at least one ad format:\n\n - [Banner](/ad-manager/mobile-ads-sdk/unity/banner)\n - [Interstitial](/ad-manager/mobile-ads-sdk/unity/interstitial)\n - [Rewarded](/ad-manager/mobile-ads-sdk/unity/rewarded)\n - [Rewarded interstitial](/ad-manager/mobile-ads-sdk/unity/rewarded-interstitial)\n - [Native](/ad-manager/mobile-ads-sdk/unity/native)\n\nImplement a paid event handler\n\nEach ad format has an `OnPaidEvent` event. During the lifecycle of an ad event,\nthe Google Mobile Ads SDK monitors impression events and invokes the handler\nwith an earned value.\n\nThe code below demonstrates how to handle paid events for a rewarded ad: \n\n```c#\nRewardedAd rewardedAd;\n\nprivate void RequestRewardedAd()\n{\n rewardedAd = new RewardedAd(\"\u003cvar class=\"readonly\" translate=\"no\"\u003eAD_UNIT_ID\u003c/var\u003e\");\n \n rewardedAd.OnPaidEvent += this.HandleAdPaidEvent;\n \n AdRequest adRequest = new AdRequest();\n rewardedAd.LoadAd(adRequest);\n}\n\n\npublic void HandleAdPaidEvent(object sender, AdValueEventArgs args)\n{\n // TODO: Send the impression-level ad revenue information to your\n // preferred analytics server directly within this callback.\n\n AdValue adValue = args.AdValue;\n long valueMicros = adValue.Value;\n string currencyCode = adValue.CurrencyCode;\n PrecisionType precision = adValue.Precision;\n\n ResponseInfo responseInfo = rewardedAd.GetResponseInfo();\n string responseId = responseInfo.GetResponseId();\n\n AdapterResponseInfo loadedAdapterResponseInfo = responseInfo.GetLoadedAdapterResponseInfo();\n string adSourceId = loadedAdapterResponseInfo.AdSourceId;\n string adSourceInstanceId = loadedAdapterResponseInfo.AdSourceInstanceId;\n string adSourceInstanceName = loadedAdapterResponseInfo.AdSourceInstanceName;\n string adSourceName = loadedAdapterResponseInfo.AdSourceName;\n string adapterClassName = loadedAdapterResponseInfo.AdapterClassName;\n long latencyMillis = loadedAdapterResponseInfo.LatencyMillis;\n Dictionary<string, string\u003e credentials = loadedAdapterResponseInfo.AdUnitMapping;\n\n Dictionary<string, string\u003e extras = responseInfo.GetResponseExtras();\n string mediationGroupName = extras[\"mediation_group_name\"];\n string mediationABTestName = extras[\"mediation_ab_test_name\"];\n string mediationABTestVariant = extras[\"mediation_ab_test_variant\"];\n}\n```\n\nFor more information on the winning ad source, see [retrieving Information\nabout the ad response](/ad-manager/mobile-ads-sdk/unity/response-info).\n\nIntegrating with App Attribution Partners (AAP)\n\nFor complete details on forwarding ad revenue data to analytics platforms,\nrefer to the partner's guide:\n\n| Partner SDK |\n|----------------------------------------------------------------------------------------------------------------------------------------|\n| [Adjust](https://dev.adjust.com/en/sdk/unity/integrations/admob) |\n| [AppsFlyer](//support.appsflyer.com/hc/en-us/articles/4416353506833) |\n| [Singular](//support.singular.net/hc/en-us/articles/360037635452-Unity-SDK-Integration-Guide#42_Adding_Ad_Revenue_Attribution_Support) |\n| [Tenjin](//docs.tenjin.com/en/send-events/unity.html#ilrd) |\n\nImplementation best practices\n\n- Set the `OnPaidEvent` event immediately once you create or get access to the ad object, and definitely before showing the ad. This ensures that you don't miss any callbacks.\n- Send the impression-level ad revenue information to your preferred analytics server immediately in your `OnPaidEvent` handler. This ensures that you don't accidentally drop any callbacks and avoids data discrepancies.\n\nAdValue\n\n`AdValue` is a class that represents the monetary value earned for an ad,\nincluding the value's currency code and its precision type encoded as below.\n| **Key Point:** The value of `AdValue` is a micro value that represents each ad's worth. For example, a value of 5,000 indicates that this ad is estimated to be worth $0.005.\n\n| `AdValue.PrecisionType` | Description |\n|-------------------------|--------------------------------------------------------------------------------------------------------------------|\n| `Unknown` | An ad value that's unknown. This gets returned when LTV pingback is enabled but there isn't enough data available. |\n| `Estimated` | An ad value estimated from aggregated data. |\n| `PublisherProvided` | A publisher provided ad value, such as manual CPMs in a mediation group. |\n| `Precise` | The precise value of this ad. |\n\nIn case of mediation, Ad Manager tries to provide an `ESTIMATED` value for ad\nsources that have automatic data collection turned on. For more information, see\n[Automatic data collection](//support.google.com/admanager/answer/6240051). For\nad sources that don't have automatic data collection turned on, or in cases\nwhere there aren't enough aggregated data to report a meaningful estimation, the\n`PUBLISHER_PROVIDED` value is returned.\n\nTest impressions from Open Bidding\n\nAfter an impression-level ad revenue event occurs for\nan Open Bidding\nad source through a test request, you receive only the following\nvalues:\n\n- `Unknown`: indicates the precision type.\n\n\u003c!-- --\u003e\n\n- `0`: indicates the ad value.\n\nPreviously, you might have seen the precision type as a value other than\n`Unknown`\nand an ad value more than `0`.\n\nFor details on sending a test ad request, see\n[Enable test devices](/ad-manager/mobile-ads-sdk/unity/test-ads#enable-test-devices)."]]