مجمّعة
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
لا يمكن أحيانًا الحصول على جميع المعلومات المطلوبة من تقرير واحد، على سبيل المثال، عندما تكون لديك سمات ومقاييس غير متوافقة، أو عندما تبحث عن تجميع البيانات بطرق مختلفة.
في هذه الحالات، عليك تشغيل تقارير متعدّدة.
بالإضافة إلى ذلك، يُعدّ تجميع البيانات طريقة فعّالة لتحسين أداء تطبيقك وتقليل عدد الطلبات.
مشكلة تقديم طلبات مستقلة متعددة
هناك حل بسيط يمكن تنفيذه، ولكن إرسال طلبات متعددة من واجهة برمجة التطبيقات في فترة زمنية قصيرة قد يؤدي إلى فرض قيود على الحصة.
يتمثل الحل الأفضل في تجنب الطلبات الموازية تمامًا، وإنشاء طلبات مجمَّعة بدلاً من ذلك.
تجميع التقارير
في مثال التطبيق المستند إلى المستخدم، يكون النهج الأول هو دمج أكبر عدد ممكن من الطلبات المستقلة في طلب مُجمَّع واحد.
التقرير 1: أهم 10 بلدان في آب (أغسطس)
التقرير 2: قيم للبلدان العشرة نفسها في شهر تموز (يوليو) للمقارنة
التقرير 3: أفضل 10 قنوات لشهر آب (أغسطس)
التقرير 4: قيم القنوات العشر نفسها في تموز (يوليو) للمقارنة
في المثال أعلاه، يكون التقريران 1 و3 مستقلين، ولكن لا يمكن دمجهما في تقرير واحد، لأنهما يقدمان تقسيمات مختلفة للبيانات. ومع ذلك، يمكن تجميعها معًا.
لا يمكن تشغيل التقريرَين 2 و4 إلا بعد الحصول على نتائج الدفعة الأولى، لأنّنا نحتاج إلى إعداد فلتر مناسب في الطلب. ويمكن تنفيذ هذه العمليات كدُفعة ثانية بعد وصول نتائج الدفعة الأولى.
هناك خيار مختلف سيسمح بدمج كل الطلبات في دفعة واحدة، وهو عرض جميع القيم لشهر تموز (يوليو) (بدلاً من أهم 10 قيم فقط)، وربما في آب (أغسطس) أيضًا. قد يكون هذا الخيار معقولاً استنادًا إلى حجم حساب AdSense المعني ومقدار الذاكرة المتاحة لتطبيقك.
طريقة العمل
يتم التعامل مع التجميع بشكل مختلف في كل مكتبة عميل، لذلك يجب عليك التحقق من وثائقها لمعرفة التفاصيل. في ما يلي بعض الروابط المؤدية إلى الوثائق ذات الصلة في العديد من مكتبات العملاء:
الخطوات التالية
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eBatching requests improves app performance by reducing the number of API calls and mitigating quota limitations.\u003c/p\u003e\n"],["\u003cp\u003eIndependent reports, like those with incompatible dimensions or metrics, can be combined into batch requests.\u003c/p\u003e\n"],["\u003cp\u003eBatching can involve grouping related reports or retrieving broader data sets to minimize the total number of batches.\u003c/p\u003e\n"],["\u003cp\u003eSpecific batching implementations vary by client library (.NET, PHP, Python, Java, Ruby, etc.).\u003c/p\u003e\n"],["\u003cp\u003eFor handling very large reports or incompatible dimensions and metrics, refer to the provided resources for further guidance.\u003c/p\u003e\n"]]],["When single reports can't provide all necessary data due to incompatible dimensions or different aggregation needs, multiple reports are required. Batching multiple API requests improves app performance and reduces quota limitations, avoiding parallel requests. Independent requests, like retrieving top countries and channels, can be combined into a single batch. Subsequent requests for comparison data can be batched afterward, once the initial batch results are available. Client libraries offer varied methods for batching, requiring consultation of their respective documentation.\n"],null,["# Batch\n\nSometimes it's not possible to get all the information you need out of a single report, such as when you have incompatible dimensions and metrics, or when you're looking to aggregate data in different ways.\n\nIn those situations, you'll need to run multiple reports.\n\nAlso, batching is an effective way to improve your app's performance, reducing the number of requests.\n\nThe problem with making multiple independent requests\n-----------------------------------------------------\n\nWhile a simple solution to implement, making multiple API requests in a short amount of time may cause you to run into quota limitations.\n\nA better solution is to avoid the parallel requests altogether, and instead create batch requests.\n\nReport batching\n---------------\n\nIn the example of a user-driven application, a first approach would be to combine as many independent requests as possible into a single batch request.\n\n\n**Report 1:** Top 10 countries for August \n\n**Report 2:** Values for same 10 countries in July, for comparison \n\n**Report 3:** Top 10 channels for August \n\n**Report 4:** Values for same 10 channels in July, for comparison\n\nIn the above example, reports 1 and 3 are independent, but cannot be combined into a single report, since they offer different breakdowns of the data. They can, however, be batched together.\n\nReports 2 and 4 can only be run after obtaining the results of the first batch, since we need to set up an appropriate filter in the request. These can be run as a second batch, once the results from the first arrive.\n\nA different option, which would allow all requests to be combined into a single batch, would be to simply return all values for July (instead of just the top 10), and potentially August as well. This may be a reasonable option depending on the size of the AdSense account in question and the amount of memory available to your application.\n\nHow it's done\n-------------\n\nBatching is handled differently in each client library, so you should check its documentation in order to find out the details. Here are some links to the relevant documentation in several client libraries:\n\n- [.NET](https://developers.google.com/api-client-library/dotnet/guide/batch)\n- [PHP](https://developers.google.com/api-client-library/php/guide/batch)\n- [Python](https://developers.google.com/api-client-library/python/guide/batch)\n- [Java](https://code.google.com/p/google-api-java-client/wiki/Batch)\n- [Ruby](https://developers.google.com/api-client-library/ruby/guide/batch)\n\n\u003cbr /\u003e\n\nNext steps\n----------\n\n- [Running Large Reports](/adsense/management/reporting/large_reports)\n- [Incompatible Dimensions and Metrics](/adsense/management/reporting/dimensions_metrics#incompatible)"]]