หากต้องการพูดคุยและแสดงความคิดเห็นเกี่ยวกับผลิตภัณฑ์ของเรา โปรดเข้าร่วมช่อง Discord อย่างเป็นทางการของ Ad Manager ในเซิร์ฟเวอร์ชุมชนการโฆษณาและการวัดผลของ Google
เมื่อเกิดการแสดงผล Google Mobile Ads SDK จะให้ข้อมูลรายได้จากโฆษณา
ที่เชื่อมโยงกับการแสดงผลนั้น คุณสามารถใช้ข้อมูลเพื่อคำนวณมูลค่าตลอดช่วงชีวิตของผู้ใช้
หรือส่งต่อข้อมูลไปยังระบบอื่นๆ ที่เกี่ยวข้องได้
โฆษณาแต่ละรูปแบบมีOnPaidEventเหตุการณ์ ในวงจรของเหตุการณ์โฆษณา
Google Mobile Ads 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"];}
[null,null,["อัปเดตล่าสุด 2025-08-31 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,["# Impression-level ad revenue\n\nWhen 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\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------------------------------\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\n### Integrating 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\n### Implementation 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\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\n### Test 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)."]]