تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
عرض إعلان ثابت
يعرض هذا المثال إعلانًا داعمًا باستخدام مكتبة "علامة الناشر من Google" (GPT).
اطّلِع على مزيد من المعلومات عن الإعلانات الرئيسية في
مركز مساعدة "مدير إعلانات Google".
معاينة الإعلانات الثابتة
يمكنك عرض إعلان تجريبي للإعلانات الثابتة على أي صفحة تعرض الإعلانات باستخدام GPT عن طريق إضافة #gamTopAnchorDemo أو #gamBottomAnchorDemo إلى عنوان URL. على سبيل المثال:
https://www.example.com/#gamTopAnchorDemo.
يمكن استخدام هذه الوظيفة لمعاينة الإعلانات الثابتة على موقعك الإلكتروني بدون الحاجة إلى إجراء أي تغييرات على الرمز البرمجي. ويُعدّ ذلك مفيدًا بشكل خاص للتحقّق سريعًا من شكل العناصر المرسِلة
وطريقة عملها على الأجهزة المختلفة وفي بيئات التشغيل المختلفة.
ملاحظات الاستخدام
لضمان تقديم تجربة مثالية للمستخدم، لا يتم عرض الإعلانات الثابتة إلا على
الصفحات التي تتيح عرض هذا التنسيق بشكلٍ سليم. ولهذا السبب،
قد تُعرِض defineOutOfPageSlot() قيمة فارغة. عليك التحقّق من هذه الحالة لمحاولة
تجنُّب إجراء أي عمل غير ضروري. في الوقت الحالي، يُسمح باستخدام الإعلانات الثابتة
في حال استيفاء الشروط التالية:
يتم تشغيل GPT في النافذة العلوية.
في الصفحة المحسّنة للأجهزة الجوّالة التي تكون فيها ميزة التصغير/التكبير محايدة، يعني ذلك عادةً أنّ الناشر لديه <meta name="viewport" content="width=device-width,
initial-scale=1"> أو ما شابه ذلك في <head> الصفحة.
إطار العرض في الوضع العمودي بعرض يتراوح بين 320px و
1000px
لا تطلب الإعلانات الثابتة إلا على الصفحات أو البيئات التي تريد أن
يظهر فيها إعلان ثابت. تكون الإعلانات الثابتة مؤهَّلة للعرض على أجهزة الكمبيوتر المكتبي والأجهزة اللوحية والأجهزة
الجوالة.
تُنشئ الإعلانات الثابتة حاوية إعلان خاصة بها. على عكس أنواع الإعلانات الأخرى، ليس
من الضروري تحديد <div> للإعلانات الثابتة. تنشئ الإعلانات الثابتة تلقائيًا
حاوية خاصة بها وتُدرجها في الصفحة عند ملء إعلان. قد تتداخل هذه
الحاويات مع عناصر أخرى أو تحجبها باستخدام التثبيت المطلق أو الثابت
، لذا ننصحك بتجنُّب وضع هذه العناصر في المناطق التي من المفترض أن تظهر فيها العناصر الثابتة.
في حال استخدام بنية الإعلان الأحادي الطلب (SRA) على صفحة تتضمّن خانات إعلانية متعددة،
لا تستخدِم display() إلى أن يتم إنشاء divs للخانات الإعلانية الثابتة. كما هو موضح في أفضل الممارسات المتعلّقة بالإعلانات، يطلب أول طلب إلى display()
كل خانة إعلانية تم تحديدها قبل هذه النقطة. على الرغم من أنّ خانات الإعلانات الثابتة
لا تتطلّب <div> محدّدًا مسبقًا، فإنّ خانات الإعلانات الثابتة تتطلّب ذلك. ويمكن أن يؤدي استدعاء display()
قبل ظهور هذه العناصر على الصفحة إلى إشارات
منخفضة الجودة، ما يؤدي إلى تقليل تحقيق الربح. لهذا السبب، ننصحك بتأخير
الطلب الأوّلي إلى ما بعد تحديد الفترات الثابتة.
يمكن إعادة تحميل الإعلانات الثابتة المرئية فقط. عندما يتم collapse (تصغير) خانة إعلان ثابت أو لم يتم الانتقال إليها بعد، يتم تجاهل كل طلبات refresh(). في حال استخدام disableInitialLoad() لالتحكّم يدويًا في تحميل الإعلانات وإعادة تحميلها، سيؤدي الطلب الأول
إلى refresh() إلى بدء طلب إعلان بغض النظر عن مستوى رؤية الخانة.
[null,null,[],[],[],null,["# Display an anchor ad\n====================\n\nThis example displays an anchor ad using the Google Publisher Tag (GPT) library.\nLearn more about anchor ads in the\n[Google Ad Manager help center](//support.google.com/admanager/answer/10452255).\n\nPreview anchor ads\n------------------\n\nYou can display a demo anchor ad on any page that shows ads with GPT by adding\n`#gamTopAnchorDemo` or `#gamBottomAnchorDemo` to the URL. For example,\n`https://www.example.com/#gamTopAnchorDemo`.\n\nThis functionality can be used to preview anchor ads on your site with no code\nchanges required. This is especially useful to quickly validate how anchors will\nlook and behave on different devices and in different operating environments.\n\nUsage notes\n-----------\n\n- **To ensure an optimal user experience, anchor ads are only requested on\n pages that properly support the format.** Because of this,\n `defineOutOfPageSlot()` may return null; you should check for this case to\n ensure you're not doing any unnecessary work. Currently, anchor ads are\n supported if the following conditions are met:\n\n - GPT is running in the top window.\n - On a mobile optimized page where zoom is neutral; typically this means the publisher has `\u003cmeta name=\"viewport\" content=\"width=device-width,\n initial-scale=1\"\u003e` or similar in the `\u003chead\u003e` of the page.\n - Viewport is in a portrait orientation with a width between `320px` and `1000px`.\n- **Only request anchor ads on pages/environments where you want an anchor to\n appear.** Anchor ads are eligible to serve to desktop, tablet, and mobile\n devices.\n\n | **Note:** You can use Chrome DevTools [mobile simulation](//developers.google.com/web/tools/chrome-devtools/device-mode#viewport) to test anchor ads on mobile from a desktop environment.\n- **Anchor ads generate their own ad container.** Unlike other ad types, it's\n not necessary to define a `\u003cdiv\u003e` for anchor ads. Anchor ads automatically\n create and insert their own container into the page when an ad fills. These\n containers may overlap or occlude other elements using absolute or fixed\n positioning, so it's recommended to avoid placing such elements in areas\n where anchors are meant to appear.\n\n- **If using single-request architecture (SRA) on a page with multiple slots,\n don't call `display()` until static ad slots divs are created.** As\n explained in [Ad Best Practices](//developers.google.com/publisher-tag/guides/ad-best-practices#use_single_request_architecture_correctly), the first call to `display()`\n requests every ad slot defined prior to that point. Although anchor ad slots\n do not require a predefined `\u003cdiv\u003e`, static ad slots do. Calling `display()`\n before these elements are present on the page can result in lower quality\n signals, reducing monetization. Because of this, we recommend delaying the\n initial call until after the static slots are defined.\n\n- **Only visible anchor ads may be refreshed.** When an anchor ad slot is\n collapsed or not yet scrolled into view, all calls to `refresh()` are\n ignored. If you're using `googletag.setConfig({ disableInitialLoad: true })`\n to manually [control ad loading and refresh](//developers.google.com/publisher-tag/guides/control-ad-loading), however, the\n first call to `refresh()` will trigger an ad request regardless of the slot\n visibility.\n\nSample implementation\n---------------------\n\n[View demo](https://googleads.github.io/google-publisher-tag-samples/display-anchor-ad/js/demo.html) This sample makes use of library features that are not fully supported when running in an iframe. To view a demo of this sample in a new window, click the **View demo** button above. \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/display-anchor-ad/js) [Report an issue](https://github.com/googleads/google-publisher-tag-samples/issues/new?labels=documentation&template=sample-feedback.md&title=Sample+feedback%3A+display-anchor-ad/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/display-anchor-ad/ts) [Report an issue](https://github.com/googleads/google-publisher-tag-samples/issues/new?labels=documentation&template=sample-feedback.md&title=Sample+feedback%3A+display-anchor-ad/ts)"]]