شروع کنید
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
این سند برای توسعه دهندگانی است که می خواهند از API مدیریت AdSense برای دریافت اطلاعات مربوط به حساب AdSense خود استفاده کنند. این سند فرض می کند که شما با مفاهیم برنامه نویسی وب و فرمت های داده های وب آشنا هستید.
قبل از اینکه تو شروع کنی
یک حساب AdSense دریافت کنید
برای شروع، ثبت نام کنید یا به حساب AdSense خود وارد شوید.
با AdSense آشنا شوید
اگر با مفاهیم AdSense آشنایی ندارید ، اطلاعات مقدماتی AdSense را بخوانید و قبل از شروع به کدنویسی با AdSense UI آزمایش کنید.
کتابخانه مشتری خود را انتخاب کنید
در صفحه «کتابخانهها و نمونههای مشتری» ، اطلاعاتی درباره کتابخانهها و نمونههای موجود پیدا خواهید کرد. روی زبانه زبان انتخابی خود کلیک کنید و برای دانلود منبع پیوندها را دنبال کنید. کتابخانه های مشتری موارد زیر را برای شما انجام می دهند:
- احراز هویت
- کشف خدمات
- ساخت درخواست ها به API
- تجزیه پاسخ
دستورالعملهای نصب و پیکربندی کتابخانه مشتری انتخابی خود را که معمولاً در فایل README در فهرست اصلی مخزن یافت میشود، بخوانید.
اگر پیادهسازی شما نیازهای ویژهای دارد، مانند استفاده از زبان پشتیبانینشده، میتوانید بهجای استفاده از کتابخانه مشتری ، درخواستهای مستقیم به API بدهید .
درخواست خود را ثبت کنید
برای استفاده از AdSense Management API، باید اپلیکیشنی را که در حال توسعه آن هستید، با ایجاد یک پروژه و ایجاد یک Client ID ثبت کنید.
اپلیکیشن خود را ثبت کنید فایل های پیکربندی پروژه کتابخانه مشتری خود را با اعتبارنامه های جدیدی که ایجاد کرده اید ویرایش کنید. برای جزئیات بیشتر، اسناد کتابخانه مشتری را بررسی کنید.
توجه: حساب Google مورد استفاده برای ثبت نام باید حساب توسعه دهنده شما باشد، یعنی حسابی که می خواهید کاربران برنامه شما به عنوان توسعه دهنده برنامه ببینند. این حساب نیازی به اتصال به ورود AdSense ندارد ، زیرا کاربران در حین استفاده از برنامه، به حساب های خود دسترسی خواهند داشت.
آموزش شروع سریع
مراحل زیر را برای اولین درخواستهای خود دنبال کنید، توجه داشته باشید که این مراحل ممکن است بسته به کتابخانه یا زبانی که استفاده میکنید کمی متفاوت باشد:
- از نمونه مناسب برای بازیابی لیستی از مشتریان آگهی از حساب AdSense استفاده کنید. این درخواست فرآیندی یکباره را آغاز می کند که در آن کاربر AdSense پروژه شما را احراز هویت و مجوز می دهد.
مشتریان تبلیغات نشان دهنده ارتباط بین یک حساب AdSense و یک محصول AdSense، مانند تبلیغات محتوا یا تبلیغات جستجو هستند. یک حساب AdSense می تواند یک یا چند مشتری تبلیغات داشته باشد.
- برای برنامههای کاربردی وب ، کاربران به سایتی هدایت میشوند که در آن میتوانند اجازه دسترسی را انتخاب کنند. پس از تأیید، آنها به URL بازگشت به تماس تعریف شده در Google API Console هدایت می شوند.
- برنامه های نصب شده به طور مشابه کار می کنند. کتابخانه مشتری سعی می کند یک پنجره مرورگر را باز کند و از یک کد مجوز استفاده کند. برای برنامه های اندروید، کروم و iOS این روش مختص پلتفرم است.
- برای درخواست گزارش زیر از Google APIs explorer for
reports.generate
استفاده کنید:-
date_range: YESTERDAY
-
dimensions: DATE
-
metrics: ESTIMATED_EARNINGS
گزارش ها به شما بینشی در مورد آنچه که در حال کسب درآمد هستید، و همچنین آنچه که بر این درآمدها تأثیر می گذارد، می دهد. آنها را می توان بر روی یک حساب کامل یا در زیر مجموعه ای از واحدهای تبلیغاتی با استفاده از کانال ها اجرا کرد.
- سعی کنید همان گزارش را از برنامه خود درخواست کنید.
- می توانید گزارش ها را بر اساس واحدهای تبلیغاتی فیلتر کنید. لیست واحدهای تبلیغاتی را با استفاده از
adunits.list
واکشی کنید. توجه داشته باشید که یک شناسه مشتری آگهی مورد نیاز است (آن را از مرحله 1 دریافت کنید). پس از انتخاب واحد تبلیغات، از شناسه آن در پارامتر فیلتر برای reports.generate
استفاده کنید: واحدهای تبلیغاتی مکانهایی برای تبلیغات پیکربندی شده توسط کاربر هستند که برخی ویژگیها را برای تبلیغات نمایش داده شده (مانند اندازه و شکل) تعریف میکنند.
-
date_range: YESTERDAY
-
dimensions: DATE
-
metrics: ESTIMATED_EARNINGS
-
filter: AD_UNIT_ID==ca-pub-123456789:987654321
- فیلتر کردن توسط کانال های سفارشی یا URL یا مخلوط کردن چندین فیلتر را امتحان کنید.
کانال ها ابزارهایی هستند که به شما امکان می دهند عملکرد زیر مجموعه ای از واحدهای تبلیغاتی خود را ردیابی کنید. دو نوع کانال وجود دارد: URL و سفارشی. اولی به شما امکان میدهد عملکرد را در یک صفحه یا دامنه خاص ردیابی کنید، در حالی که دومی به شما کمک میکند عملکرد را در گروههای خاصی از واحدهای تبلیغاتی انتخاب شده توسط کاربر ردیابی کنید.
شما آماده هستید تا با کاوش بقیه تماس ها و منابع موجود در مستندات مرجع ، اجرای خود را شروع کنید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eStarts ADH import of a specified BigQuery table containing a quarterly brand lift benchmark report, triggered by the customer.\u003c/p\u003e\n"],["\u003cp\u003eRequires specifying the year, quarter, and source BigQuery table in the request body.\u003c/p\u003e\n"],["\u003cp\u003eUses POST request to \u003ccode\u003ehttps://adsdatahub.googleapis.com/v1/{customer=customers/*}:submitBrandLiftBenchmark\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eNeeds \u003ccode\u003ehttps://www.googleapis.com/auth/adsdatahub\u003c/code\u003e authorization scope.\u003c/p\u003e\n"],["\u003cp\u003eReturns an Operation object upon successful submission.\u003c/p\u003e\n"]]],["To use the AdSense Management API, first, obtain an AdSense account and familiarize yourself with it. Select a client library or make direct API requests. Register your application to get a Client ID, and configure your project with the credentials. Retrieve a list of ad clients, then generate reports using the API explorer or your application. Filter reports by ad units or channels, and explore the API reference documentation to start implementing your code.\n"],null,["# Get Started\n\nThis document is for developers who want to use the AdSense Management API to get\ninformation about their AdSense account. This document assumes that you're\nfamiliar with web programming concepts and web data formats.\n\nBefore you start\n----------------\n\n### Get an AdSense account\n\nSign up or sign in to your [AdSense\naccount](//adsense.google.com/) to get started.\n\n### Get familiar with AdSense\n\nIf you're not familiar with AdSense concepts read the [introductory information on AdSense](//support.google.com/adsense)\nand experiment with the [AdSense UI](//adsense.google.com/)\nbefore starting to code.\n\n### Choose your client library\n\nIn the [Client Libraries and Samples\npage](/adsense/management/libraries), you'll find information on the available libraries and samples. Click\nthe tab for your chosen language and follow the links to download the source.\nThe client libraries handle the following for you:\n\n- authentication\n- discovery of services\n- building the requests to the API\n- response parsing\n\nRead the instructions to install and configure your chosen client library,\ntypically found in the README file in the root directory of the repository.\n\nIf your implementation has special needs, such as using an unsupported\nlanguage, you can [make direct\nrequests](/adsense/management/direct_requests) to the API instead of using a client library.\n\nRegister your application\n-------------------------\n\nTo use the AdSense Management API you must register the application you're developing\nby creating a project and generating a Client ID.\nRegister your app\n\nEdit the configuration files for your client library project with the new\ncredentials you just created. Check the client library documentation for more\ndetails.\n\n**Note:** The Google Account used for registration should be\nyour **developer** account, that is, the account that you want users of your\napplication to see as the developer of the application. **This account does\nnot need to be tied to an AdSense login**, as users will be granting access\nto their own accounts while using the application.\n\nQuick start tutorial\n--------------------\n\nFollow the steps below to make your first requests, note that these steps\nmay vary slightly depending on the library or language you are using:\n\n1. Use the appropriate sample to retrieve a list of ad clients from an AdSense account. This request initiates a one-time process in which the AdSense user authenticates and authorizes your project. **Ad clients** represent an association between an\n AdSense account and an AdSense product, such as Content Ads or Search Ads.\n An AdSense account can have one or multiple ad clients.\n\n 1. For **web applications**, users will be redirected to a site where they can choose to grant access. Once authorized, they will be redirected to the callback URL defined in the Google API Console.\n 2. **Installed applications** work similarly. The client library will try to open a browser window and use an authorization code. For Android, Chrome and iOS applications this method is platform-specific.\n2. Use the [Google APIs explorer for\n `reports.generate`](/adsense/management/reference/rest/v2/accounts.reports/generate) to request the following report:\n - `date_range: YESTERDAY`\n - `dimensions: DATE`\n - `metrics: ESTIMATED_EARNINGS`\n\n **Reports** give you insight into what you're earning,\n as well as what's having an impact on those earnings. They can be run on\n an entire account or on a subset of ad units, through the use of\n channels.\n3. Try to request the same report from your application.\n4. You can filter the reports by ad units. Fetch the list of ad units using [adunits.list](/adsense/management/reference/rest/v2/accounts.adclients.adunits/list). Note that an ad client ID is needed (get it from step 1). After you choose an ad unit, use its ID in the [filter](/adsense/management/reporting/filtering) parameter for `reports.generate`:\n\n **Ad Units** are user-configured placeholders for ads,\n that define some properties for the ads being shown (such as size and\n shape).\n - `date_range: YESTERDAY`\n - `dimensions: DATE`\n - `metrics: ESTIMATED_EARNINGS`\n - `filter: AD_UNIT_ID==ca-pub-123456789:987654321`\n5. Try filtering by custom or URL channels or mixing multiple filters. **Channels** are tools that let you track the\n performance of a subset of your ad units. There are two types of channels:\n URL and custom. The former lets you track performance across a specific\n page or domain, whereas the latter help you track performance on specific\n user-selected groups of ad units.\n\nYou are ready to start your implementation by exploring the rest of the\navailable calls and resources in the [reference\ndocumentation](/adsense/management/reference/rest)."]]