تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تصغير الخانات الإعلانية الفارغة
يتم تلقائيًا إبقاء خانات الإعلانات غير المملوءة مرئية، ما قد يؤدي إلى
ترك مساحة فارغة على صفحتك. إذا كنت تعلم مسبقًا أنّه من غير المرجّح أن يتمّ ملء خانة إعلان واحدة أو أكثر على
صفحتك، يمكنك توجيه مكتبة "علامة الناشر من Google"
(GPT) إلى تصغيرها.
يعتمد الإعداد الأمثل لهذه الميزة على معدّل ملء خانات الإعلانات:
إذا كانت الفتحات ستتم تعبئتها معظم الوقت، استخدِم
PubAdsService.collapseEmptyDivs(). في هذا
الإعداد، يتمّ توسيع الخانات الإعلانية تلقائيًا ولا يتمّ تصغيرها إلا إذا
تعذّر ملؤها.
إذا لم تكن الفتحات ستتم تعبئتها معظم الوقت، استخدِم رمز
PubAdsService.collapseEmptyDivs(true). في
هذه الإعدادات، يتم تصغير خانات الإعلانات تلقائيًا ولا يتم توسيعها إلا إذا
كان بالإمكان ملؤها.
بما أنّ طلبات googletag API لا تؤثر إلى أن يبدأ تشغيل GPT، لمحاولة
تقليل إعادة التدفق، عليك أيضًا ضبط CSS على صفحتك لكي تصبح
المنافذ التي يتم تصغيرها تلقائيًا بدون أبعاد.
من الممكن أيضًا ضبط عمليات إلغاء لكل خانة، كما هو موضّح في المثال أدناه، إذا كان من المرجّح أن يتم ملء خانات معيّنة على صفحتك بشكل أكبر أو أقل.
[null,null,[],[],[],null,["# Collapse empty ad slots\n=======================\n\nBy default, ad slots which are not filled are left visible, which may result in\nblank space on your page. If you know ahead of time that one or more ad slots on\nyour page are unlikely to get filled, you can instruct the Google Publisher Tag\n(GPT) library to collapse them.\n| **Caution:** Incorrect use of this feature can cause additional reflow of the content of your page.\n\nThe optimal configuration of this feature will depend on how often you expect ad\nslots to be filled:\n\n1. If slots will be filled most of the time, use [`collapseDiv: 'ON_NO_FILL'`](//developers.google.com/publisher-tag/reference#googletag.config.PageSettingsConfig.collapseDiv). In this configuration, ad slots are expanded by default and collapse only if they cannot be filled.\n2. If slots will not be filled most of the time, use [`collapseDiv: 'BEFORE_FETCH'`](//developers.google.com/publisher-tag/reference#googletag.config.PageSettingsConfig.collapseDiv). In this configuration, ad slots are collapsed by default and only expand if they can be filled.\n\nBecause `googletag` API calls have no effect until GPT begins to run, to\nminimize reflow you will also need to configure the CSS on your page so that\nslots which are collapsed by default have zero dimensions.\n\nIt's also possible to configure per-slot overrides, as shown in the example\nbelow, if specific slots on your page are more or less likely to be filled.\n\nSample implementation\n---------------------\n\n[View demo](https://googleads.github.io/google-publisher-tag-samples/collapse-empty-ad-slots/js/demo.html) \n\n### JavaScript\n\nLoading...\n----------\n\nLoading...\n----------\n\n[Improve this sample](https://github.com/googleads/google-publisher-tag-samples/tree/main/dist/collapse-empty-ad-slots/js) [Report an issue](https://github.com/googleads/google-publisher-tag-samples/issues/new?labels=documentation&template=sample-feedback.md&title=Sample+feedback%3A+collapse-empty-ad-slots/js)\n\n### TypeScript\n\nLoading...\n----------\n\nLoading...\n----------\n\n[Improve this sample](https://github.com/googleads/google-publisher-tag-samples/tree/main/dist/collapse-empty-ad-slots/ts) [Report an issue](https://github.com/googleads/google-publisher-tag-samples/issues/new?labels=documentation&template=sample-feedback.md&title=Sample+feedback%3A+collapse-empty-ad-slots/ts)"]]