با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
هنگامی که یک نمایش رخ میدهد، Google Mobile Ads SDK دادههای درآمد تبلیغات مرتبط با آن نمایش را ارائه میکند. میتوانید از دادهها برای محاسبه ارزش طول عمر کاربر استفاده کنید، یا دادهها را به سیستمهای مرتبط دیگر ارسال کنید.
این راهنما برای کمک به شما در پیادهسازی جمعآوری دادههای درآمد تبلیغاتی در سطح نمایش در پروژه Unity طراحی شده است.
هر قالب تبلیغاتی یک رویداد 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"];}
رویداد OnPaidEvent را بلافاصله پس از ایجاد یا دسترسی به شیء تبلیغ، و قطعاً قبل از نمایش آگهی، تنظیم کنید. این تضمین می کند که هیچ تماسی را از دست ندهید.
اطلاعات درآمد تبلیغات در سطح نمایش را فوراً در کنترلر OnPaidEvent خود به سرور تجزیه و تحلیل ترجیحی خود ارسال کنید. این تضمین می کند که به طور تصادفی هیچ تماسی را رها نمی کنید و از اختلاف داده ها جلوگیری می کند.
AdValue
AdValue کلاسی است که ارزش پولی کسب شده برای یک آگهی را نشان می دهد، از جمله کد ارز ارزش و نوع دقیق آن که به صورت زیر کدگذاری شده است.
AdValue.PrecisionType
توضیحات
Unknown
یک ارزش تبلیغاتی که ناشناخته است. وقتی پینگ بک LTV فعال باشد اما داده کافی در دسترس نباشد، این مورد برگردانده می شود.
Estimated
یک ارزش تبلیغاتی که از دادههای جمعآوری شده تخمین زده میشود.
PublisherProvided
یک ناشر ارزش تبلیغاتی مانند CPM های دستی در یک گروه میانجی ارائه کرد.
Precise
ارزش دقیق این آگهی
در صورت میانجیگری، Ad Manager سعی میکند برای منابع تبلیغاتی که جمعآوری خودکار دادهها را روشن کردهاند، یک مقدار ESTIMATED ارائه کند. برای اطلاعات بیشتر، به جمع آوری خودکار داده ها مراجعه کنید. برای منابع تبلیغاتی که جمعآوری خودکار دادهها روشن نیست، یا در مواردی که دادههای انبوه کافی برای گزارش یک برآورد معنادار وجود ندارد، مقدار PUBLISHER_PROVIDED برگردانده میشود.
نمایشهای آزمایشی از مناقصه آزاد
پس از اینکه یک رویداد درآمد تبلیغات در سطح نمایش برای منبع آگهی مناقصه باز از طریق یک درخواست آزمایشی رخ داد، فقط مقادیر زیر را دریافت میکنید:
Unknown : نوع دقت را نشان می دهد.
0 : ارزش تبلیغ را نشان می دهد.
قبلاً، ممکن است نوع دقیق را به عنوان مقداری غیر از Unknown و مقدار تبلیغاتی بیش از 0 مشاهده کرده باشید.
تاریخ آخرین بهروزرسانی 2025-08-30 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-30 بهوقت ساعت هماهنگ جهانی."],[[["\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)."]]