স্ট্যাটিকভাবে বিজ্ঞাপন স্ক্রিপ্ট লোড
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
ওভারভিউ
এই অডিট চেক করে যে বিজ্ঞাপনের স্ক্রিপ্টগুলি পৃষ্ঠায় ইনজেকশন করা হচ্ছে কিনা। পৃষ্ঠার অন্যান্য সংস্থানগুলি ইনজেক্টেড স্ক্রিপ্টগুলি আনয়ন এবং লোড করতে দেরি করতে পারে, যা বিজ্ঞাপনগুলি লোড করতে বিলম্বিত করবে৷ কিছু পরিস্থিতিতে এই স্ক্রিপ্টগুলি মোটেও আনা যাবে না, বিজ্ঞাপনগুলিকে একসাথে লোড করা থেকে বাধা দেয়৷
সুপারিশ
গতি উন্নত করতে অ্যাসিঙ্ক স্ক্রিপ্ট ট্যাগের মাধ্যমে স্ক্রিপ্ট লোড করুন। ব্রাউজার প্রিলোড স্ক্যানার আগে স্ক্রিপ্ট ট্যাগ আনতে পারে, এমনকি যদি রেন্ডার ব্লকিং রিসোর্স স্ক্রিপ্ট এক্সিকিউশনকে ব্লক করে।
ভুল | <script>
var el = document.createElement('script');
el.src = 'https://securepubads.g.doubleclick.net/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(el, node);
</script> |
সঠিক | <script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script> |
ইনজেকশন করা বিজ্ঞাপন স্ক্রিপ্টের উৎস শনাক্ত করুন
কখনও কখনও এটি স্পষ্ট নাও হতে পারে যে কীভাবে একটি বিজ্ঞাপন স্ক্রিপ্ট একটি পৃষ্ঠায় ইনজেকশন করা হচ্ছে, বা এমনকি এটি আদৌ ইনজেকশন করা হচ্ছে। উদাহরণস্বরূপ, লোড হওয়ার পরে একটি পৃষ্ঠার উত্স পরীক্ষা করার সময়, একটি স্ক্রিপ্ট ট্যাগ যা ইনজেকশন করা হয়েছে তা স্ট্যাটিক্যালি লোড করা ট্যাগ থেকে আলাদা করা যায় না।
এই ক্ষেত্রে, ইনজেকশন করা বিজ্ঞাপন স্ক্রিপ্টের উৎস নির্ধারণ করতে Chrome DevTools-এ নেটওয়ার্ক ট্যাব ব্যবহার করুন।
-
Control+Shift+J
বা Command+Option+J
(Mac) টিপে DevTools খুলুন। - নেটওয়ার্ক ট্যাবে নেভিগেট করুন।
- যদি ইতিমধ্যে দৃশ্যমান না হয়, ফিল্টার ক্লিক করুন
ফিল্টার বার খুলতে এবং টেক্সট বক্সে এই অডিট দ্বারা পতাকাঙ্কিত স্ক্রিপ্টের নাম টাইপ করুন। - যদি ইতিমধ্যে দৃশ্যমান না হয়, তাহলে যেকোনো টেবিল হেডারে ডান-ক্লিক করুন এবং নেটওয়ার্ক অনুরোধ জলপ্রপাত টেবিলে ইনিশিয়েটর কলাম অন্তর্ভুক্ত করতে ইনিশিয়েটর নির্বাচন করুন।
- নেটওয়ার্ক ট্র্যাফিক ক্যাপচার করতে পৃষ্ঠাটি পুনরায় লোড করুন৷

উপরের স্ক্রিনশটে দেখা গেছে, ইনিশিয়েটর কলামে প্রশ্নে থাকা স্ক্রিপ্টের উৎস সম্পর্কে তথ্য থাকবে। আপনি বিজ্ঞাপন স্ক্রিপ্ট অনুরোধ জারি করার জন্য দায়ী কোডে সরাসরি লাফ দিতে উৎস লিঙ্কে ক্লিক করতে পারেন, অথবা অনুরোধের দিকে এগিয়ে যাওয়া সমস্ত কল দেখতে উৎস লিঙ্কের উপর হোভার করতে পারেন।
এই অডিট বিজ্ঞাপন স্ক্রিপ্টগুলির একটি অনুমোদিত তালিকার বিরুদ্ধে কাজ করে যা স্ট্যাটিকভাবে লোড করা নিরাপদ বলে পরিচিত৷ বর্তমান তালিকা হল:
লাইব্রেরি | স্ক্রিপ্ট(গুলি) |
---|
অ্যাডসেন্স | pagead2.googlesyndication.com/pagead/js/adsbygoogle.js |
আমাজন প্রকাশক পরিষেবা | amazon-adsystem.com/aax2/apstag.js |
Criteo সরাসরি দরদাতা | static.criteo.net/js/*/publishertag.js |
Google প্রকাশক ট্যাগ | googletagservices.com/tag/js/gpt.js securepubads.g.doubleclick.net/tag/js/gpt.js |
ইনডেক্স এক্সচেঞ্জ | js-sec.indexww.com/ht/p/*.js |
document.write() এর বিরুদ্ধে হস্তক্ষেপ করা
স্ক্রিপ্ট-ইনজেক্ট করা "অ্যাসিঙ্ক স্ক্রিপ্টগুলি" ক্ষতিকারক বলে বিবেচিত৷
অ্যাসিঙ্ক স্নিপেটগুলিকে ত্বরান্বিত করা৷
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2024-11-12 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2024-11-12 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eThis audit identifies ad scripts injected into the page that may delay or prevent ad loading.\u003c/p\u003e\n"],["\u003cp\u003eUse async script tags to improve loading speed, enabling the browser to fetch scripts earlier.\u003c/p\u003e\n"],["\u003cp\u003eIf the source of an injected ad script is unclear, Chrome DevTools' Network tab can be used to identify it.\u003c/p\u003e\n"],["\u003cp\u003eA list of safe-to-load ad scripts is provided, including those from AdSense, Amazon, Criteo, Google Publisher Tag, and Index Exchange.\u003c/p\u003e\n"]]],["Ad scripts injected into a page can delay or prevent ad loading. To improve speed, load scripts using `async` script tags, allowing the browser to fetch them earlier. To identify injected scripts, use Chrome DevTools' Network tab: filter by the script name and enable the \"Initiator\" column to find the source. The document provides examples of correct and incorrect code for loading scripts and includes a list of ad scripts from AdSense, Amazon, Criteo, Google Publisher Tag, and Index Exchange.\n"],null,["# Load ad scripts statically\n\nOverview\n--------\n\nThis audits checks whether or not ad scripts are being injected into the page.\nOther resources on the page may delay the fetching and loading of injected\nscripts, which will in turn delay the loading of ads. In some situations these\nscripts may not be fetched at all, preventing ads from being loaded all\ntogether.\n\nRecommendations\n---------------\n\nLoad scripts via async script tags to improve speed. The browser preload scanner\ncan fetch script tags earlier, even if render blocking resources are blocking\nthe script execution.\n\n|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Incorrect** | ```html \u003cscript\u003e var el = document.createElement('script'); el.src = 'https://securepubads.g.doubleclick.net/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(el, node); \u003c/script\u003e ``` |\n| **Correct** | ```html \u003cscript async src=\"https://securepubads.g.doubleclick.net/tag/js/gpt.js\"\u003e\u003c/script\u003e ``` |\n\n### Identify the source of injected ad scripts\n\nSometimes it may not be obvious how an ad script is being injected into a page,\nor even that it's being injected at all. For example, when examining the source\nof a page after it's loaded, a script tag that has been injected may appear\nindistinguishable from a tag that was loaded statically.\n\nIn these cases, use the Network tab in Chrome DevTools to determine the source\nof injected ad scripts.\n\n1. Open DevTools by pressing `Control+Shift+J` or `Command+Option+J` (Mac).\n2. Navigate to the **Network** tab.\n3. If not already visible, click **Filter** to open the filter bar and type the name of the script flagged by this audit into the text box.\n4. If not already visible, right-click on any table header and select **Initiator** to include the Initiator column in the network request waterfall table.\n5. Reload the page to capture network traffic.\n\nAs seen in the above screenshot, the initiator column will contain information\nabout the source of the script in question. You can click on the source link to\njump directly to the code responsible for issuing the ad script request, or\nhover over the source link to see all of the calls leading up to the request.\n\nMore information\n----------------\n\nThis audit operates against a allowlist of ad scripts which are known to be safe\nto load statically. The current list is:\n\n| Library | Script(s) |\n|---------------------------|--------------------------------------------------------------------------------------|\n| AdSense | `pagead2.googlesyndication.com/pagead/js/adsbygoogle.js` |\n| Amazon Publisher Services | `amazon-adsystem.com/aax2/apstag.js` |\n| Criteo Direct Bidder | `static.criteo.net/js/*/publishertag.js` |\n| Google Publisher Tag | `googletagservices.com/tag/js/gpt.js` `securepubads.g.doubleclick.net/tag/js/gpt.js` |\n| Index Exchange | `js-sec.indexww.com/ht/p/*.js` |\n\n[Intervening against document.write()](https://developers.google.com/web/updates/2016/08/removing-document-write) \n\n[Script-injected \"async scripts\" considered harmful](https://www.igvita.com/2014/05/20/script-injected-async-scripts-considered-harmful/) \n\n[Speeding Up Async Snippets](https://csswizardry.com/2022/10/speeding-up-async-snippets/) \n[View audit source](https://github.com/googleads/publisher-ads-lighthouse-plugin/tree/HEAD/lighthouse-plugin-publisher-ads/audits/script-injected-tags.js) [Improve this article](https://github.com/googleads/publisher-ads-lighthouse-plugin/tree/HEAD/docs/audits/script-injected-tags.md) [Report an issue](https://github.com/googleads/publisher-ads-lighthouse-plugin/issues/new?labels=documentation&template=documentation-feedback.md&title=Documentation+feedback%3A+script-injected-tags.md)\n\n\u003cbr /\u003e"]]