এই রেফারেন্সটি টাইপস্ক্রিপ্ট নোটেশন ব্যবহার করে প্রকারগুলি বর্ণনা করে। নিম্নলিখিত টেবিলটি উদাহরণের মাধ্যমে একটি সংক্ষিপ্ত ব্যাখ্যা প্রদান করে।
| এক্সপ্রেশন টাইপ করুন | |
|---|---|
string | আদিম স্ট্রিং টাইপ। |
string[] | একটি অ্যারের ধরণ, যেখানে মানগুলি কেবল স্ট্রিং হতে পারে। |
number | string | একটি ইউনিয়ন টাইপ, যেখানে মানটি একটি সংখ্যা বা একটি স্ট্রিং হতে পারে। |
Array<number | string> | একটি অ্যারের ধরণ, যেখানে মানগুলি একটি জটিল (ইউনিয়ন) ধরণ। |
[number, string] | একটি টুপল টাইপ, যেখানে মানটি একটি দুই-উপাদানের অ্যারে যা অবশ্যই সেই ক্রমে একটি সংখ্যা এবং একটি স্ট্রিং ধারণ করবে। |
Slot | একটি অবজেক্ট টাইপ, যেখানে মানটি googletag.Slot এর একটি উদাহরণ। |
() => void | একটি ফাংশন টাইপ যার কোন সংজ্ঞায়িত আর্গুমেন্ট নেই এবং কোন রিটার্ন মান নেই। |
সমর্থিত প্রকার এবং টাইপ এক্সপ্রেশন সম্পর্কে আরও জানতে, টাইপস্ক্রিপ্ট হ্যান্ডবুকটি দেখুন।
টীকা টাইপ করুন
একটি চলক, প্যারামিটারের নাম, বৈশিষ্ট্যের নাম, অথবা ফাংশন স্বাক্ষরের পরে একটি কোলন একটি টাইপ অ্যানোটেশন নির্দেশ করে। টাইপ অ্যানোটেশনগুলি কোলনের বাম দিকের উপাদানটি যে ধরণের গ্রহণ বা ফেরত দিতে পারে তা বর্ণনা করে। নিম্নলিখিত টেবিলটি এই রেফারেন্সে আপনি যে ধরণের অ্যানোটেশনগুলি দেখতে পাবেন তার উদাহরণ দেখায়।
| টাইপ টীকা | |
|---|---|
param: string | নির্দেশ করে যে param একটি স্ট্রিং মান গ্রহণ করে বা ফেরত দেয়। এই সিনট্যাক্সটি ভেরিয়েবল, প্যারামিটার, প্রোপার্টি এবং রিটার্ন টাইপের জন্য ব্যবহৃত হয়। |
param?: number | string | নির্দেশ করে যে param ঐচ্ছিক, কিন্তু নির্দিষ্ট করা হলে একটি সংখ্যা অথবা একটি স্ট্রিং গ্রহণ করে। এই সিনট্যাক্সটি প্যারামিটার এবং বৈশিষ্ট্যের জন্য ব্যবহৃত হয়। |
...params: Array<() => void> | নির্দেশ করে যে params হল একটি বিশ্রাম প্যারামিটার যা ফাংশন গ্রহণ করে। বিশ্রাম প্যারামিটার নির্দিষ্ট ধরণের একটি সীমাহীন সংখ্যক মান গ্রহণ করে। |
googletag
| নামস্থান | |
|---|---|
config | পৃষ্ঠা-স্তরের সেটিংসের জন্য প্রধান কনফিগারেশন ইন্টারফেস। |
enums | এটি হল সেই নেমস্পেস যা GPT enum টাইপের জন্য ব্যবহার করে। |
events | এই নেমস্পেসটি GPT ইভেন্টের জন্য ব্যবহার করে। |
secure Signals | এটি হল সেই নেমস্পেস যা GPT নিরাপদ সিগন্যাল পরিচালনার জন্য ব্যবহার করে। |
| ইন্টারফেস | |
|---|---|
Command Array | কমান্ড অ্যারে ফাংশনের একটি ক্রম গ্রহণ করে এবং সেগুলিকে ক্রমানুসারে আহ্বান করে। |
Companion Ads Service | কম্প্যানিয়ন বিজ্ঞাপন পরিষেবা। |
Privacy Settings Config | গোপনীয়তা সেটিংসের জন্য কনফিগারেশন অবজেক্ট। |
Pub Ads Service | প্রকাশক বিজ্ঞাপন পরিষেবা। |
Response Information | একটি একক বিজ্ঞাপন প্রতিক্রিয়া প্রতিনিধিত্বকারী একটি বস্তু। |
Rewarded Payload | পুরস্কৃত বিজ্ঞাপনের সাথে সম্পর্কিত পুরষ্কারের প্রতিনিধিত্বকারী একটি বস্তু। |
Service | বেস সার্ভিস ক্লাস যাতে সকল পরিষেবার জন্য সাধারণ পদ্ধতি রয়েছে। |
Size Mapping Builder | আকার ম্যাপিং স্পেসিফিকেশন অবজেক্টের জন্য নির্মাতা। |
Slot | স্লট হলো একটি বস্তু যা একটি পৃষ্ঠায় একটি একক বিজ্ঞাপন স্লটকে প্রতিনিধিত্ব করে। |
| টাইপ উপনাম | |
|---|---|
General Size | একটি স্লটের জন্য একটি বৈধ আকারের কনফিগারেশন, যা এক বা একাধিক আকারের হতে পারে। |
Multi Size | একক বৈধ আকারের একটি তালিকা। |
Named Size | একটি স্লটে যে মাপ থাকতে পারে তার নামকরণ করা হয়েছে। |
Single Size | একটি স্লটের জন্য একটি একক বৈধ আকার। |
Single Size Array | [প্রস্থ, উচ্চতা] প্রতিনিধিত্বকারী দুটি সংখ্যার অ্যারে। |
Size Mapping | ভিউপোর্টের আকারের সাথে বিজ্ঞাপনের আকারের একটি ম্যাপিং। |
Size Mapping Array | আকার ম্যাপিংয়ের একটি তালিকা। |
| ভেরিয়েবল | |
|---|---|
api Ready | GPT API লোড হয়েছে এবং কল করার জন্য প্রস্তুত তা নির্দেশ করে ফ্ল্যাগ করুন। |
cmd | GPT-সম্পর্কিত কলগুলির অ্যাসিঙ্ক্রোনাস এক্সিকিউশনের জন্য গ্লোবাল কমান্ড কিউ-এর রেফারেন্স। |
pubads Ready | PubAdsService সক্রিয়, লোড এবং সম্পূর্ণরূপে কার্যকর তা নির্দেশ করে এমন পতাকা। |
secure Signal Providers | নিরাপদ সংকেত সরবরাহকারী অ্যারের রেফারেন্স। |
| ফাংশন | |
|---|---|
companion Ads | CompanionAdsService এর একটি রেফারেন্স ফেরত দেয়। |
define Out Of Page Slot | প্রদত্ত বিজ্ঞাপন ইউনিট পাথ দিয়ে একটি পৃষ্ঠার বাইরের বিজ্ঞাপন স্লট তৈরি করে। |
define Slot | একটি নির্দিষ্ট বিজ্ঞাপন ইউনিট পাথ এবং আকারের সাথে একটি বিজ্ঞাপন স্লট তৈরি করে এবং এটিকে সেই পৃষ্ঠার একটি div উপাদানের ID এর সাথে সংযুক্ত করে যেখানে বিজ্ঞাপনটি থাকবে। |
destroy Slots | প্রদত্ত স্লটগুলি ধ্বংস করে, GPT থেকে সেই স্লটগুলির সমস্ত সম্পর্কিত বস্তু এবং রেফারেন্সগুলি সরিয়ে দেয়। |
disable Publisher Console | Google প্রকাশক কনসোল অক্ষম করে। |
display | স্লট পরিষেবাগুলিকে স্লট রেন্ডার করার নির্দেশ দেয়। |
enable Services | পৃষ্ঠার বিজ্ঞাপন স্লটের জন্য নির্ধারিত সমস্ত GPT পরিষেবা সক্ষম করে। |
get Config | setConfig দ্বারা সেট করা পৃষ্ঠার জন্য সাধারণ কনফিগারেশন বিকল্পগুলি পায়। |
get Version | GPT এর বর্তমান সংস্করণটি ফেরত পাঠায়। |
open Console | Google প্রকাশক কনসোল খোলে। |
pubads | PubAdsService এর একটি রেফারেন্স ফেরত দেয়। |
set Ad Iframe Title | এই বিন্দু থেকে, PubAdsService দ্বারা তৈরি সমস্ত বিজ্ঞাপন কন্টেইনার আইফ্রেমের শিরোনাম সেট করে। |
set Config | পৃষ্ঠার জন্য সাধারণ কনফিগারেশন বিকল্পগুলি সেট করে। |
size Mapping | একটি নতুন SizeMappingBuilder তৈরি করে। |
টাইপ উপনাম
সাধারণ আকার
GeneralSize : SingleSize | MultiSizeমাল্টিসাইজ
MultiSize : SingleSize []নামযুক্ত আকার
NamedSize : "fluid" | [ "fluid" ]- fluid : বিজ্ঞাপনের ধারকটি প্যারেন্ট ডিভের ১০০% প্রস্থ নেয় এবং তারপর সৃজনশীল কন্টেন্টের সাথে মানানসই করে তার উচ্চতার আকার পরিবর্তন করে। একটি পৃষ্ঠার নিয়মিত ব্লক উপাদানগুলি যেভাবে আচরণ করে তার অনুরূপ। নেটিভ বিজ্ঞাপনের জন্য ব্যবহৃত হয় ( সম্পর্কিত নিবন্ধ দেখুন)। মনে রাখবেন যে
fluidএবং['fluid']উভয়ই একটি স্লট আকারকে fluid হিসাবে ঘোষণা করার জন্য গ্রহণযোগ্য ফর্ম।
একক আকার
SingleSize : SingleSizeArray | NamedSizeসিঙ্গেলসাইজঅ্যারে
SingleSizeArray : [ number , number ]সাইজম্যাপিং
SizeMapping : [ SingleSizeArray , GeneralSize ]সাইজম্যাপিংঅ্যারে
SizeMappingArray : SizeMapping []ভেরিয়েবল
Const এপিরেডি
apiReady : boolean | undefinedundefined থাকবে।মনে রাখবেন যে async পরিচালনা করার প্রস্তাবিত উপায় হল GPT প্রস্তুত হওয়ার সময় কলব্যাকগুলি সারিবদ্ধ করার জন্য googletag.cmd ব্যবহার করা। এই কলব্যাকগুলিকে googletag.apiReady চেক করতে হবে না কারণ API সেট আপ হয়ে গেলে এগুলি কার্যকর হওয়ার নিশ্চয়তা রয়েছে।
Const সিএমডি
cmd : ( ( this : typeof globalThis ) => void ) [] | CommandArraygoogletag.cmd ভেরিয়েবলটি পৃষ্ঠার GPT ট্যাগ সিনট্যাক্স দ্বারা একটি খালি জাভাস্ক্রিপ্ট অ্যারেতে ইনিশিয়ালাইজ করা হয় এবং cmd.push হল স্ট্যান্ডার্ড Array.push পদ্ধতি যা অ্যারের শেষে একটি উপাদান যোগ করে। যখন GPT জাভাস্ক্রিপ্ট লোড করা হয়, তখন এটি অ্যারের মধ্য দিয়ে অনুসন্ধান করে এবং সমস্ত ফাংশনগুলিকে ক্রমানুসারে কার্যকর করে। এরপর স্ক্রিপ্টটি cmd একটি CommandArray অবজেক্ট দিয়ে প্রতিস্থাপন করে যার push পদ্ধতিটি এটিতে প্রেরিত ফাংশন আর্গুমেন্ট কার্যকর করার জন্য সংজ্ঞায়িত করা হয়। এই প্রক্রিয়াটি GPT কে জাভাস্ক্রিপ্টকে অ্যাসিঙ্ক্রোনাসভাবে আনার মাধ্যমে অনুভূত ল্যাটেন্সি হ্রাস করতে দেয় এবং ব্রাউজারকে পৃষ্ঠাটি রেন্ডার করা চালিয়ে যাওয়ার অনুমতি দেয়।- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.cmd.push(() => { googletag.defineSlot("/1234567/sports", [160, 600]).addService(googletag.pubads()); });
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.cmd.push(function () { googletag.defineSlot("/1234567/sports", [160, 600]).addService(googletag.pubads()); });
টাইপস্ক্রিপ্ট
googletag.cmd.push(() => { googletag.defineSlot("/1234567/sports", [160, 600])!.addService(googletag.pubads()); });
Const পাবডস রেডি
pubadsReady : boolean | undefinedundefined থাকবে। সিকিউরসিগন্যালপ্রোভাইডার
secureSignalProviders : SecureSignalProvider [] | SecureSignalProvidersArray | undefinedসিকিউর সিগন্যাল প্রোভাইডার অ্যারে সিগন্যাল-জেনারেটিং ফাংশনের একটি ক্রম গ্রহণ করে এবং সেগুলিকে ক্রমানুসারে আহ্বান করে। এটি একটি স্ট্যান্ডার্ড অ্যারে প্রতিস্থাপন করার উদ্দেশ্যে তৈরি করা হয়েছে যা GPT লোড হওয়ার পরে সিগন্যাল-জেনারেটিং ফাংশনগুলিকে আহ্বান করার জন্য সারিবদ্ধ করতে ব্যবহৃত হয়।
- উদাহরণ
জাভাস্ক্রিপ্ট
window.googletag = window.googletag || { cmd: [] }; googletag.secureSignalProviders = googletag.secureSignalProviders || []; googletag.secureSignalProviders.push({ id: "collector123", collectorFunction: () => { return Promise.resolve("signal"); }, });
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
window.googletag = window.googletag || { cmd: [] }; googletag.secureSignalProviders = googletag.secureSignalProviders || []; googletag.secureSignalProviders.push({ id: "collector123", collectorFunction: function () { return Promise.resolve("signal"); }, });
টাইপস্ক্রিপ্ট
window.googletag = window.googletag || { cmd: [] }; googletag.secureSignalProviders = googletag.secureSignalProviders || []; googletag.secureSignalProviders.push({ id: "collector123", collectorFunction: () => { return Promise.resolve("signal"); }, });
- আরো দেখুন
ফাংশন
সঙ্গী বিজ্ঞাপন
companionAds ( ) : CompanionAdsService| রিটার্নস | |
|---|---|
CompanionAdsService | কম্প্যানিয়ন বিজ্ঞাপন পরিষেবা। |
DefineOutOfPageSlot
defineOutOfPageSlot ( adUnitPath : string , div ?: string | OutOfPageFormat ) : Slot | nullকাস্টম আউট-অফ-পেজ বিজ্ঞাপনের জন্য,
div হল সেই div উপাদানের ID যেখানে বিজ্ঞাপনটি থাকবে। আরও বিস্তারিত জানার জন্য আউট-অফ-পেজ ক্রিয়েটিভ সম্পর্কিত নিবন্ধটি দেখুন।GPT পরিচালিত পৃষ্ঠার বাইরের বিজ্ঞাপনগুলির জন্য,
div হল একটি সমর্থিত OutOfPageFormat ।- উদাহরণ
জাভাস্ক্রিপ্ট
// Define a custom out-of-page ad slot. googletag.defineOutOfPageSlot("/1234567/sports", "div-1"); // Define a GPT managed web interstitial ad slot. googletag.defineOutOfPageSlot("/1234567/sports", googletag.enums.OutOfPageFormat.INTERSTITIAL);
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
// Define a custom out-of-page ad slot. googletag.defineOutOfPageSlot("/1234567/sports", "div-1"); // Define a GPT managed web interstitial ad slot. googletag.defineOutOfPageSlot("/1234567/sports", googletag.enums.OutOfPageFormat.INTERSTITIAL);
টাইপস্ক্রিপ্ট
// Define a custom out-of-page ad slot. googletag.defineOutOfPageSlot("/1234567/sports", "div-1"); // Define a GPT managed web interstitial ad slot. googletag.defineOutOfPageSlot("/1234567/sports", googletag.enums.OutOfPageFormat.INTERSTITIAL);
- আরো দেখুন
| পরামিতি | |
|---|---|
adUnitPath : string | নেটওয়ার্ক কোড এবং বিজ্ঞাপন ইউনিট কোড সহ সম্পূর্ণ বিজ্ঞাপন ইউনিট পাথ । |
| যে ডিভটিতে এই বিজ্ঞাপন ইউনিট বা OutOfPageFormat থাকবে তার আইডি। |
| রিটার্নস | |
|---|---|
Slot | null | নতুন তৈরি স্লট, অথবা যদি স্লট তৈরি করা না যায় তাহলে null । |
ডিফাইনস্লট
defineSlot ( adUnitPath : string , size : GeneralSize , div ?: string ) : Slot | null- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.defineSlot("/1234567/sports", [728, 90], "div-1");
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.defineSlot("/1234567/sports", [728, 90], "div-1");
টাইপস্ক্রিপ্ট
googletag.defineSlot("/1234567/sports", [728, 90], "div-1");
- আরো দেখুন
| পরামিতি | |
|---|---|
adUnitPath : string | নেটওয়ার্ক কোড এবং ইউনিট কোড সহ সম্পূর্ণ বিজ্ঞাপন ইউনিট পাথ । |
size : GeneralSize | যোগ করা স্লটের প্রস্থ এবং উচ্চতা। যদি কোনও প্রতিক্রিয়াশীল আকারের ম্যাপিং প্রদান করা না হয় অথবা ভিউপোর্টের আকার ম্যাপিংয়ে প্রদত্ত ক্ষুদ্রতম আকারের চেয়ে ছোট হয়, তাহলে বিজ্ঞাপনের অনুরোধে এই আকারটি ব্যবহার করা হয়। |
| এই বিজ্ঞাপন ইউনিটটি যে ডিভটিতে থাকবে তার আইডি। |
| রিটার্নস | |
|---|---|
Slot | null | নতুন তৈরি স্লট, অথবা যদি স্লট তৈরি করা না যায় তাহলে null । |
ধ্বংস স্লট
destroySlots ( slots ?: Slot [] ) : booleanএই API কে একটি স্লটে কল করলে বিজ্ঞাপনটি মুছে যাবে এবং GPT দ্বারা রক্ষণাবেক্ষণ করা অভ্যন্তরীণ অবস্থা থেকে স্লট অবজেক্টটি সরিয়ে ফেলা হবে। স্লট অবজেক্টে আর কোনও ফাংশন কল করলে অনির্ধারিত আচরণ দেখা দেবে। মনে রাখবেন, ব্রাউজারটি এখনও সেই স্লটের সাথে সম্পর্কিত মেমরি মুক্ত নাও করতে পারে যদি প্রকাশক পৃষ্ঠা এটির একটি রেফারেন্স বজায় রাখে। এই API কল করলে সেই স্লটের সাথে সম্পর্কিত div পুনরায় ব্যবহারের জন্য উপলব্ধ হয়।
বিশেষ করে, একটি স্লট ধ্বংস করলে বিজ্ঞাপনটি GPT-এর দীর্ঘস্থায়ী পেজভিউ থেকে সরে যাবে, তাই ভবিষ্যতের অনুরোধগুলি এই বিজ্ঞাপনের সাথে জড়িত রোডব্লক বা প্রতিযোগিতামূলক বর্জন দ্বারা প্রভাবিত হবে না। পৃষ্ঠা থেকে একটি স্লটের ডিভ অপসারণের আগে এই ফাংশনটি কল করতে ব্যর্থ হলে অনির্ধারিত আচরণ দেখা দেবে।
- উদাহরণ
জাভাস্ক্রিপ্ট
// The calls to construct an ad and display contents. const slot1 = googletag.defineSlot("/1234567/sports", [728, 90], "div-1"); googletag.display("div-1"); const slot2 = googletag.defineSlot("/1234567/news", [160, 600], "div-2"); googletag.display("div-2"); // This call to destroy only slot1. googletag.destroySlots([slot1]); // This call to destroy both slot1 and slot2. googletag.destroySlots([slot1, slot2]); // This call to destroy all slots. googletag.destroySlots();
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
// The calls to construct an ad and display contents. var slot1 = googletag.defineSlot("/1234567/sports", [728, 90], "div-1"); googletag.display("div-1"); var slot2 = googletag.defineSlot("/1234567/news", [160, 600], "div-2"); googletag.display("div-2"); // This call to destroy only slot1. googletag.destroySlots([slot1]); // This call to destroy both slot1 and slot2. googletag.destroySlots([slot1, slot2]); // This call to destroy all slots. googletag.destroySlots();
টাইপস্ক্রিপ্ট
// The calls to construct an ad and display contents. const slot1 = googletag.defineSlot("/1234567/sports", [728, 90], "div-1")!; googletag.display("div-1"); const slot2 = googletag.defineSlot("/1234567/news", [160, 600], "div-2")!; googletag.display("div-2"); // This call to destroy only slot1. googletag.destroySlots([slot1]); // This call to destroy both slot1 and slot2. googletag.destroySlots([slot1, slot2]); // This call to destroy all slots. googletag.destroySlots();
| পরামিতি | |
|---|---|
| ধ্বংস করার জন্য স্লটের অ্যারে। অ্যারে ঐচ্ছিক; যদি এটি নির্দিষ্ট না থাকে তবে সমস্ত স্লট ধ্বংস হয়ে যাবে। |
| রিটার্নস | |
|---|---|
boolean | স্লট ধ্বংস হয়ে গেলে true , অন্যথায় false । |
প্রকাশক কনসোল অক্ষম করুন
disablePublisherConsole ( ) : void- আরো দেখুন
প্রদর্শন
display ( divOrSlot : string | Element | Slot ) : voidযদি একক অনুরোধ আর্কিটেকচার (SRA) ব্যবহার করা হয়, তাহলে এই পদ্ধতিটি কল করার সময় সমস্ত আনফেক্টেড বিজ্ঞাপন স্লট একবারে আনা হবে। একটি বিজ্ঞাপন স্লট যাতে প্রদর্শিত না হয় তার জন্য, সম্পূর্ণ ডিভটি সরিয়ে ফেলতে হবে।
- আরো দেখুন
| পরামিতি | |
|---|---|
divOrSlot : string | Element | Slot | হয় বিজ্ঞাপন স্লট ধারণকারী div উপাদানের ID অথবা div উপাদান, অথবা slot বস্তু। যদি একটি div উপাদান প্রদান করা হয়, তাহলে এটিতে একটি 'id' বৈশিষ্ট্য থাকতে হবে যা defineSlot এ পাস করা ID এর সাথে মেলে। |
পরিষেবাগুলি সক্ষম করুন
enableServices ( ) : voidgetConfig সম্পর্কে
getConfig ( keys : string | string [] ) : Pick < PageSettingsConfig , "adsenseAttributes" | "disableInitialLoad" | "targeting" >এই পদ্ধতিতে সমস্ত
setConfig() বৈশিষ্ট্য সমর্থিত নয়। সমর্থিত বৈশিষ্ট্যগুলি হল:- উদাহরণ
জাভাস্ক্রিপ্ট
// Get the value of the `targeting` setting. const targetingConfig = googletag.getConfig("targeting"); // Get the value of the `adsenseAttributes` and `disableInitialLoad` settings. const config = googletag.getConfig(["adsenseAttributes", "disableInitialLoad"]);
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
// Get the value of the `targeting` setting. var targetingConfig = googletag.getConfig("targeting"); // Get the value of the `adsenseAttributes` and `disableInitialLoad` settings. var config = googletag.getConfig(["adsenseAttributes", "disableInitialLoad"]);
টাইপস্ক্রিপ্ট
// Get the value of the `targeting` setting. const targetingConfig = googletag.getConfig("targeting"); // Get the value of the `adsenseAttributes` and `disableInitialLoad` settings. const config = googletag.getConfig(["adsenseAttributes", "disableInitialLoad"]);
| পরামিতি | |
|---|---|
keys : string | string [] | কনফিগারেশন অপশনের কীগুলি পেতে হবে। |
| রিটার্নস | |
|---|---|
Pick < PageSettingsConfig , "adsenseAttributes" | "disableInitialLoad" | "targeting" > | স্লটের জন্য কনফিগারেশন বিকল্পগুলি। |
ভার্সন পান
getVersion ( ) : string- আরো দেখুন
| রিটার্নস | |
|---|---|
string | বর্তমানে চলমান GPT সংস্করণ স্ট্রিং। |
ওপেনকনসোল
openConsole ( div ?: string ) : void- উদাহরণ
জাভাস্ক্রিপ্ট
// Calling with div ID. googletag.openConsole("div-1"); // Calling without div ID. googletag.openConsole();
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
// Calling with div ID. googletag.openConsole("div-1"); // Calling without div ID. googletag.openConsole();
টাইপস্ক্রিপ্ট
// Calling with div ID. googletag.openConsole("div-1"); // Calling without div ID. googletag.openConsole();
- আরো দেখুন
| পরামিতি | |
|---|---|
| একটি বিজ্ঞাপন স্লট ডিভ আইডি। এই মানটি ঐচ্ছিক। প্রদান করা হলে, প্রকাশক কনসোল নির্দিষ্ট বিজ্ঞাপন স্লটের বিবরণ সামনে রেখে খোলার চেষ্টা করবে। |
পাবডস
pubads ( ) : PubAdsService| রিটার্নস | |
|---|---|
PubAdsService | প্রকাশক বিজ্ঞাপন পরিষেবা। |
সেটএডিফ্রেমটাইটেল
setAdIframeTitle ( title : string ) : void- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.setAdIframeTitle("title");
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.setAdIframeTitle("title");
টাইপস্ক্রিপ্ট
googletag.setAdIframeTitle("title");
| পরামিতি | |
|---|---|
title : string | সকল বিজ্ঞাপন কন্টেইনার আইফ্রেমের জন্য নতুন শিরোনাম। |
সেটকনফিগ
setConfig ( config : PageSettingsConfig ) : void| পরামিতি | |
|---|---|
config : PageSettingsConfig | |
আকার ম্যাপিং
sizeMapping ( ) : SizeMappingBuilder| রিটার্নস | |
|---|---|
SizeMappingBuilder | একজন নতুন নির্মাতা। |
গুগলট্যাগ.কমান্ডঅ্যারে
| পদ্ধতি | |
|---|---|
push | আর্গুমেন্টগুলিতে নির্দিষ্ট ফাংশনের ক্রম ক্রমানুসারে কার্যকর করে। |
পদ্ধতি
ধাক্কা দেওয়া
push ( ... f : ( ( this : typeof globalThis ) => void ) [] ) : number- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.cmd.push(() => { googletag.defineSlot("/1234567/sports", [160, 600]).addService(googletag.pubads()); });
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.cmd.push(function () { googletag.defineSlot("/1234567/sports", [160, 600]).addService(googletag.pubads()); });
টাইপস্ক্রিপ্ট
googletag.cmd.push(() => { googletag.defineSlot("/1234567/sports", [160, 600])!.addService(googletag.pubads()); });
| পরামিতি | |
|---|---|
| একটি জাভাস্ক্রিপ্ট ফাংশন এক্সিকিউট করতে হবে। রানটাইম বাইন্ডিং সর্বদা globalThis হবে। এনক্লোজিং লেক্সিকাল কনটেক্সটের this মান ধরে রাখার জন্য একটি তীর ফাংশন পাস করার কথা বিবেচনা করুন। |
| রিটার্নস | |
|---|---|
number | এখন পর্যন্ত প্রসেস করা কমান্ডের সংখ্যা। এটি Array.push এর রিটার্ন মানের (অ্যারের বর্তমান দৈর্ঘ্য) সাথে সামঞ্জস্যপূর্ণ। |
গুগলট্যাগ.কম্প্যানিয়নঅ্যাডসসার্ভিস
Service প্রসারিত করে| পদ্ধতি | |
|---|---|
add Event Listener | একটি লিসেনার নিবন্ধন করে যা আপনাকে পৃষ্ঠায় একটি নির্দিষ্ট GPT ইভেন্ট ঘটলে একটি জাভাস্ক্রিপ্ট ফাংশন সেট আপ এবং কল করতে দেয়। |
get Slots | এই পরিষেবার সাথে সম্পর্কিত স্লটগুলির তালিকা পান। |
remove Event Listener | পূর্বে নিবন্ধিত শ্রোতাকে সরিয়ে দেয়। |
set Refresh Unfilled Slots | পূরণ না করা সঙ্গী স্লটগুলি স্বয়ংক্রিয়ভাবে ব্যাকফিল হবে কিনা তা সেট করে। |
পদ্ধতি
সেটরিফ্রেশআনফিল্ডস্লট
setRefreshUnfilledSlots ( value : boolean ) : voidপৃষ্ঠার জীবদ্দশায় ব্যাকফিল চালু এবং বন্ধ করার জন্য এই পদ্ধতিটি একাধিকবার কল করা যেতে পারে। শুধুমাত্র PubAdsService-এর সাথে নিবন্ধিত স্লটগুলি ব্যাকফিল করা হবে। নীতিগত বিধিনিষেধের কারণে, যখন কোনও Ad Exchange ভিডিও পরিবেশন করা হয় তখন খালি সহযোগী স্লটগুলি পূরণ করার জন্য এই পদ্ধতিটি ডিজাইন করা হয়নি।
- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.companionAds().setRefreshUnfilledSlots(true);
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.companionAds().setRefreshUnfilledSlots(true);
টাইপস্ক্রিপ্ট
googletag.companionAds().setRefreshUnfilledSlots(true);
| পরামিতি | |
|---|---|
value : boolean | খালি স্লটগুলি স্বয়ংক্রিয়ভাবে ব্যাকফিল করার জন্য true , অপরিবর্তিত রাখার জন্য false । |
গুগলট্যাগ। গোপনীয়তা সেটিংস কনফিগ
| বৈশিষ্ট্য | |
|---|---|
child Directed Treatment ? | পৃষ্ঠাটিকে শিশু-নির্দেশিত হিসেবে বিবেচনা করা উচিত কিনা তা নির্দেশ করে। |
limited Ads ? | প্রকাশকের নিয়ন্ত্রক সম্মতির চাহিদা পূরণে সহায়তা করার জন্য সীমিত বিজ্ঞাপন মোডে পরিবেশন সক্ষম করে। |
non Personalized Ads ? | প্রকাশকের নিয়ন্ত্রক সম্মতির চাহিদা পূরণে সহায়তা করার জন্য , ব্যক্তিগতকৃত নয় এমন বিজ্ঞাপন মোডে পরিবেশন সক্ষম করে। |
restrict Data Processing ? | প্রকাশকের নিয়ন্ত্রক সম্মতির চাহিদা পূরণে সহায়তা করার জন্য সীমাবদ্ধ প্রক্রিয়াকরণ মোডে পরিবেশন সক্ষম করে। |
traffic Source ? | অনুরোধগুলি ক্রয়কৃত নাকি জৈব ট্র্যাফিকের প্রতিনিধিত্ব করে তা নির্দেশ করে। |
under Age Of Consent ? | সম্মতির বয়সের কম বয়সী ব্যবহারকারীদের কাছ থেকে আসা বিজ্ঞাপনের অনুরোধগুলি চিহ্নিত করা হবে কিনা তা নির্দেশ করে। |
- আরো দেখুন
বৈশিষ্ট্য
Optional শিশু নির্দেশিত চিকিৎসা
childDirectedTreatment ?: booleannull এ সেট করুন। Optional সীমিত বিজ্ঞাপন
limitedAds ?: booleanআপনি GPT-কে দুটি উপায়ে সীমিত বিজ্ঞাপনের অনুরোধ করার নির্দেশ দিতে পারেন:
- স্বয়ংক্রিয়ভাবে, IAB TCF v2.0 সম্মতি ব্যবস্থাপনা প্ল্যাটফর্ম থেকে একটি সংকেত ব্যবহার করে।
- ম্যানুয়ালি, এই ক্ষেত্রের মান
trueতে সেট করে।
মনে রাখবেন যে, যখন কোনও CMP ব্যবহার করা হচ্ছে তখন সীমিত বিজ্ঞাপনগুলি ম্যানুয়ালি সক্ষম করার প্রয়োজন নেই।
- উদাহরণ
জাভাস্ক্রিপ্ট
// Manually enable limited ads serving. // GPT must be loaded from the limited ads URL to configure this setting. googletag.pubads().setPrivacySettings({ limitedAds: true, });
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
// Manually enable limited ads serving. // GPT must be loaded from the limited ads URL to configure this setting. googletag.pubads().setPrivacySettings({ limitedAds: true, });
টাইপস্ক্রিপ্ট
// Manually enable limited ads serving. // GPT must be loaded from the limited ads URL to configure this setting. googletag.pubads().setPrivacySettings({ limitedAds: true, });
- আরো দেখুন
Optional অ-ব্যক্তিগতকৃত বিজ্ঞাপন
nonPersonalizedAds ?: boolean Optional সীমাবদ্ধ ডেটা প্রসেসিং
restrictDataProcessing ?: boolean Optional ট্রাফিকসোর্স
trafficSource ?: TrafficSourceundefined হয়ে যায়।- উদাহরণ
জাভাস্ক্রিপ্ট
// Indicate requests represent organic traffic. googletag.pubads().setPrivacySettings({ trafficSource: googletag.enums.TrafficSource.ORGANIC, }); // Indicate requests represent purchased traffic. googletag.pubads().setPrivacySettings({ trafficSource: googletag.enums.TrafficSource.PURCHASED, });
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
// Indicate requests represent organic traffic. googletag.pubads().setPrivacySettings({ trafficSource: googletag.enums.TrafficSource.ORGANIC, }); // Indicate requests represent purchased traffic. googletag.pubads().setPrivacySettings({ trafficSource: googletag.enums.TrafficSource.PURCHASED, });
টাইপস্ক্রিপ্ট
// Indicate requests represent organic traffic. googletag.pubads().setPrivacySettings({ trafficSource: googletag.enums.TrafficSource.ORGANIC, }); // Indicate requests represent purchased traffic. googletag.pubads().setPrivacySettings({ trafficSource: googletag.enums.TrafficSource.PURCHASED, });
AgeOfConsent এর অধীনে Optional
underAgeOfConsent ?: booleannull এ সেট করুন। গুগলট্যাগ.পাবঅ্যাডসসার্ভিস
Service প্রসারিত করে| পদ্ধতি | |
|---|---|
add Event Listener | একটি লিসেনার নিবন্ধন করে যা আপনাকে পৃষ্ঠায় একটি নির্দিষ্ট GPT ইভেন্ট ঘটলে একটি জাভাস্ক্রিপ্ট ফাংশন সেট আপ এবং কল করতে দেয়। |
clear | প্রদত্ত স্লট থেকে বিজ্ঞাপনগুলি সরিয়ে দেয় এবং ফাঁকা কন্টেন্ট দিয়ে প্রতিস্থাপন করে। |
clear Category Exclusions | বন্ধ করা হয়েছে। সমস্ত পৃষ্ঠা-স্তরের বিজ্ঞাপন বিভাগ বর্জন লেবেল মুছে দেয়। |
clear Targeting | অবচিত। একটি নির্দিষ্ট কী বা সমস্ত কী-এর জন্য কাস্টম টার্গেটিং প্যারামিটার সাফ করে। |
collapse Empty Divs | বন্ধ করা হয়েছে। স্লট ডিভগুলিকে সঙ্কুচিত করা সক্ষম করে যাতে প্রদর্শনের জন্য কোনও বিজ্ঞাপন সামগ্রী না থাকলে পৃষ্ঠায় কোনও স্থান না নেয়। |
disable Initial Load | বন্ধ করা হয়েছে। পৃষ্ঠা লোডের সময় বিজ্ঞাপনের অনুরোধগুলি অক্ষম করে, কিন্তু PubAdsService.refresh কলের মাধ্যমে বিজ্ঞাপনের অনুরোধ করার অনুমতি দেয়। |
display | প্রদত্ত বিজ্ঞাপন ইউনিট পাথ এবং আকার সহ একটি বিজ্ঞাপন স্লট তৈরি করে এবং প্রদর্শন করে। |
enable Lazy Load | অবচিত। কনফিগ অবজেক্ট দ্বারা সংজ্ঞায়িত GPT-তে অলস লোডিং সক্ষম করে। |
enable Single Request | বন্ধ করা হয়েছে। একই সময়ে একাধিক বিজ্ঞাপন আনার জন্য একক অনুরোধ মোড সক্ষম করে। |
enable Video Ads | বন্ধ করা হয়েছে। GPT-কে সংকেত দেয় যে পৃষ্ঠায় ভিডিও বিজ্ঞাপন উপস্থিত থাকবে। |
get | বন্ধ করা হয়েছে। প্রদত্ত কী-এর সাথে সম্পর্কিত AdSense অ্যাট্রিবিউটের মান প্রদান করে। |
get Attribute Keys | অবচিত। এই পরিষেবাতে সেট করা অ্যাট্রিবিউট কীগুলি ফেরত পাঠায়। |
get Slots | এই পরিষেবার সাথে সম্পর্কিত স্লটগুলির তালিকা পান। |
get Targeting | অবচিত। সেট করা একটি নির্দিষ্ট কাস্টম পরিষেবা-স্তরের টার্গেটিং প্যারামিটার ফেরত পাঠায়। |
get Targeting Keys | অবচিত। সেট করা সমস্ত কাস্টম পরিষেবা-স্তরের টার্গেটিং কীগুলির তালিকা ফেরত পাঠায়। |
is Initial Load Disabled | বন্ধ করা হয়েছে। পূর্ববর্তী PubAdsService.disableInitialLoad কলের মাধ্যমে বিজ্ঞাপনের জন্য প্রাথমিক অনুরোধগুলি সফলভাবে অক্ষম করা হয়েছে কিনা তা দেখায়। |
refresh | পৃষ্ঠার নির্দিষ্ট বা সমস্ত স্লটের জন্য নতুন বিজ্ঞাপন আনে এবং প্রদর্শন করে। |
remove Event Listener | পূর্বে নিবন্ধিত শ্রোতাকে সরিয়ে দেয়। |
set | বন্ধ করা হয়েছে। প্রকাশক বিজ্ঞাপন পরিষেবার অধীনে সমস্ত বিজ্ঞাপন স্লটে প্রযোজ্য AdSense বৈশিষ্ট্যের মান সেট করে। |
set Category Exclusion | বন্ধ করা হয়েছে। প্রদত্ত লেবেল নামের জন্য একটি পৃষ্ঠা-স্তরের বিজ্ঞাপন বিভাগ বর্জন সেট করে। |
set Centering | অবচিত। বিজ্ঞাপনের অনুভূমিক কেন্দ্রীকরণ সক্ষম এবং অক্ষম করে। |
set Force Safe Frame | বন্ধ করা হয়েছে। পৃষ্ঠার সমস্ত বিজ্ঞাপনকে একটি SafeFrame কন্টেইনার ব্যবহার করে জোর করে রেন্ডার করা উচিত কিনা তা কনফিগার করে। |
set Location | বন্ধ করা হয়েছে। ওয়েবসাইট থেকে অবস্থানের তথ্য প্রেরণ করে যাতে আপনি নির্দিষ্ট অবস্থানে লাইন আইটেমগুলিকে জিও-টার্গেট করতে পারেন। |
set Privacy Settings | একটি কনফিগ অবজেক্ট ব্যবহার করে একটি একক API থেকে সমস্ত গোপনীয়তা সেটিংস কনফিগার করার অনুমতি দেয়। |
set Publisher Provided Id | প্রকাশক-প্রদত্ত আইডির মান সেট করে। |
set Safe Frame Config | বন্ধ করা হয়েছে। সেফফ্রেম কনফিগারেশনের জন্য পৃষ্ঠা-স্তরের পছন্দগুলি সেট করে। |
set Targeting | বন্ধ করা হয়েছে। একটি নির্দিষ্ট কী-এর জন্য কাস্টম টার্গেটিং প্যারামিটার সেট করে যা সমস্ত প্রকাশক বিজ্ঞাপন পরিষেবা বিজ্ঞাপন স্লটে প্রযোজ্য। |
set Video Content | বন্ধ করা হয়েছে। লক্ষ্যবস্তু এবং সামগ্রী বাদ দেওয়ার উদ্দেশ্যে বিজ্ঞাপনের অনুরোধের সাথে পাঠানো ভিডিও সামগ্রীর তথ্য সেট করে। |
update Correlator | বিজ্ঞাপনের অনুরোধের সাথে পাঠানো কোরিলেটর পরিবর্তন করে, কার্যকরভাবে একটি নতুন পৃষ্ঠা ভিউ শুরু করে। |
পদ্ধতি
পরিষ্কার
clear ( slots ?: Slot [] ) : booleanবিশেষ করে, একটি স্লট সাফ করলে GPT-এর দীর্ঘস্থায়ী পেজভিউ থেকে বিজ্ঞাপনটি সরে যাবে, তাই ভবিষ্যতের অনুরোধগুলি এই বিজ্ঞাপনের সাথে জড়িত বাধা বা প্রতিযোগিতামূলক বর্জনের দ্বারা প্রভাবিত হবে না।
- উদাহরণ
জাভাস্ক্রিপ্ট
const slot1 = googletag.defineSlot("/1234567/sports", [728, 90], "div-1"); googletag.display("div-1"); const slot2 = googletag.defineSlot("/1234567/news", [160, 600], "div-2"); googletag.display("div-2"); // This call to clear only slot1. googletag.pubads().clear([slot1]); // This call to clear both slot1 and slot2. googletag.pubads().clear([slot1, slot2]); // This call to clear all slots. googletag.pubads().clear();
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
var slot1 = googletag.defineSlot("/1234567/sports", [728, 90], "div-1"); googletag.display("div-1"); var slot2 = googletag.defineSlot("/1234567/news", [160, 600], "div-2"); googletag.display("div-2"); // This call to clear only slot1. googletag.pubads().clear([slot1]); // This call to clear both slot1 and slot2. googletag.pubads().clear([slot1, slot2]); // This call to clear all slots. googletag.pubads().clear();
টাইপস্ক্রিপ্ট
const slot1 = googletag.defineSlot("/1234567/sports", [728, 90], "div-1")!; googletag.display("div-1"); const slot2 = googletag.defineSlot("/1234567/news", [160, 600], "div-2")!; googletag.display("div-2"); // This call to clear only slot1. googletag.pubads().clear([slot1]); // This call to clear both slot1 and slot2. googletag.pubads().clear([slot1, slot2]); // This call to clear all slots. googletag.pubads().clear();
| পরামিতি | |
|---|---|
| সাফ করার জন্য স্লটের অ্যারে। অ্যারে ঐচ্ছিক; যদি এটি নির্দিষ্ট না থাকে তবে সমস্ত স্লট সাফ করা হবে। |
| রিটার্নস | |
|---|---|
boolean | স্লট সাফ করা থাকলে true ফেরত পাঠায়, অন্যথায় false । |
পরিষ্কারবিভাগবর্জন
clearCategoryExclusions ( ) : PubAdsService- উদাহরণ
জাভাস্ক্রিপ্ট
// Set category exclusion to exclude ads with 'AirlineAd' labels. googletag.pubads().setCategoryExclusion("AirlineAd"); // Make ad requests. No ad with 'AirlineAd' label will be returned. // Clear category exclusions so all ads can be returned. googletag.pubads().clearCategoryExclusions(); // Make ad requests. Any ad can be returned.
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
// Set category exclusion to exclude ads with 'AirlineAd' labels. googletag.pubads().setCategoryExclusion("AirlineAd"); // Make ad requests. No ad with 'AirlineAd' label will be returned. // Clear category exclusions so all ads can be returned. googletag.pubads().clearCategoryExclusions(); // Make ad requests. Any ad can be returned.
টাইপস্ক্রিপ্ট
// Set category exclusion to exclude ads with 'AirlineAd' labels. googletag.pubads().setCategoryExclusion("AirlineAd"); // Make ad requests. No ad with 'AirlineAd' label will be returned. // Clear category exclusions so all ads can be returned. googletag.pubads().clearCategoryExclusions(); // Make ad requests. Any ad can be returned.
- আরো দেখুন
| রিটার্নস | |
|---|---|
PubAdsService | যে পরিষেবা অবজেক্টে পদ্ধতিটি কল করা হয়েছিল। |
স্পষ্ট লক্ষ্যবস্তু
clearTargeting ( key ?: string ) : PubAdsService- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.pubads().setTargeting("interests", "sports"); googletag.pubads().setTargeting("colors", "blue"); googletag.pubads().setTargeting("fruits", "apple"); googletag.pubads().clearTargeting("interests"); // Targeting 'colors' and 'fruits' are still present, while 'interests' // was cleared. googletag.pubads().clearTargeting(); // All targeting has been cleared.
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.pubads().setTargeting("interests", "sports"); googletag.pubads().setTargeting("colors", "blue"); googletag.pubads().setTargeting("fruits", "apple"); googletag.pubads().clearTargeting("interests"); // Targeting 'colors' and 'fruits' are still present, while 'interests' // was cleared. googletag.pubads().clearTargeting(); // All targeting has been cleared.
টাইপস্ক্রিপ্ট
googletag.pubads().setTargeting("interests", "sports"); googletag.pubads().setTargeting("colors", "blue"); googletag.pubads().setTargeting("fruits", "apple"); googletag.pubads().clearTargeting("interests"); // Targeting 'colors' and 'fruits' are still present, while 'interests' // was cleared. googletag.pubads().clearTargeting(); // All targeting has been cleared.
- আরো দেখুন
| পরামিতি | |
|---|---|
| টার্গেটিং প্যারামিটার কী। কীটি ঐচ্ছিক; যদি এটি নির্দিষ্ট না থাকে তবে সমস্ত টার্গেটিং প্যারামিটার সাফ করা হবে। |
| রিটার্নস | |
|---|---|
PubAdsService | যে পরিষেবা অবজেক্টে পদ্ধতিটি কল করা হয়েছিল। |
ধসে পড়া খালি ডিভস
collapseEmptyDivs ( collapseBeforeAdFetch ?: boolean ) : boolean| পরামিতি | |
|---|---|
| বিজ্ঞাপনগুলি আনার আগেই স্লটগুলি আড়াল করা হবে কিনা। এই প্যারামিটারটি ঐচ্ছিক; যদি না দেওয়া হয়, তাহলে ডিফল্ট মান হিসেবে false ব্যবহার করা হবে। |
| রিটার্নস | |
|---|---|
boolean | যদি div collapse মোড সক্রিয় থাকে তাহলে true এবং যদি collapse মোড সক্রিয় করা অসম্ভব হয় তাহলে false প্রদান করে কারণ পরিষেবা সক্রিয় করার পরে পদ্ধতিটি কল করা হয়েছিল। |
প্রাথমিক লোড বন্ধ করুন
disableInitialLoad ( ) : voidrefresh ব্যবহার করে বিজ্ঞাপনের অনুরোধ করা অসম্ভব হবে।প্রদর্শন
display ( adUnitPath : string , size : GeneralSize , div ?: string | Element , clickUrl ?: string ) : voidদ্রষ্টব্য: যখন এই পদ্ধতিটি কল করা হয়, তখন বিজ্ঞাপনের অনুরোধ পাঠানোর সময় এবং প্রতিক্রিয়া রেন্ডার করার সময় ধারাবাহিকতা নিশ্চিত করার জন্য স্লট এবং পৃষ্ঠার অবস্থার একটি স্ন্যাপশট তৈরি করা হয়। এই পদ্ধতিটি কল করার পরে স্লট বা পৃষ্ঠার স্থিতিতে করা যেকোনো পরিবর্তন (টার্গেটিং, গোপনীয়তা সেটিংস, ফোর্স সেফফ্রেম ইত্যাদি সহ) শুধুমাত্র পরবর্তী
display() বা refresh() অনুরোধের ক্ষেত্রে প্রযোজ্য হবে।- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.pubads().display("/1234567/sports", [728, 90], "div-1");
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.pubads().display("/1234567/sports", [728, 90], "div-1");
টাইপস্ক্রিপ্ট
googletag.pubads().display("/1234567/sports", [728, 90], "div-1");
| পরামিতি | |
|---|---|
adUnitPath : string | রেন্ডার করা স্লটের বিজ্ঞাপন ইউনিট পাথ । |
size : GeneralSize | স্লটের প্রস্থ এবং উচ্চতা। |
| হয় স্লট ধারণকারী div-এর ID, অথবা div উপাদানটি নিজেই। |
| এই স্লটে ব্যবহার করার জন্য ক্লিক URL। |
লেজিলোড সক্ষম করুন
enableLazyLoad ( config ?: {
fetchMarginPercent ?: number ;
mobileScaling ?: number ;
renderMarginPercent ?: number ;
} ) : voidদ্রষ্টব্য: SRA-তে অলস ফেচিং শুধুমাত্র তখনই কাজ করে যদি সমস্ত স্লট ফেচিং মার্জিনের বাইরে থাকে।
- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.pubads().enableLazyLoad({ // Fetch slots within 5 viewports. fetchMarginPercent: 500, // Render slots within 2 viewports. renderMarginPercent: 200, // Double the above values on mobile. mobileScaling: 2.0, });
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.pubads().enableLazyLoad({ // Fetch slots within 5 viewports. fetchMarginPercent: 500, // Render slots within 2 viewports. renderMarginPercent: 200, // Double the above values on mobile. mobileScaling: 2.0, });
টাইপস্ক্রিপ্ট
googletag.pubads().enableLazyLoad({ // Fetch slots within 5 viewports. fetchMarginPercent: 500, // Render slots within 2 viewports. renderMarginPercent: 200, // Double the above values on mobile. mobileScaling: 2.0, });
| পরামিতি | |
|---|---|
| কনফিগারেশন অবজেক্ট অলস আচরণের কাস্টমাইজেশনের অনুমতি দেয়। যেকোনো বাদ দেওয়া কনফিগারেশন Google দ্বারা সেট করা একটি ডিফল্ট সেট ব্যবহার করবে যা সময়ের সাথে সাথে টিউন করা হবে। একটি নির্দিষ্ট সেটিং, যেমন একটি ফেচিং মার্জিন, অক্ষম করতে মানটি -1 এ সেট করুন।
|
সিঙ্গেলরিকোয়েস্ট সক্ষম করুন
enableSingleRequest ( ) : boolean- আরো দেখুন
| রিটার্নস | |
|---|---|
boolean | একক অনুরোধ মোড সক্রিয় থাকলে true এবং একক অনুরোধ মোড সক্রিয় করা অসম্ভব হলে false প্রদান করে কারণ পরিষেবা সক্রিয় হওয়ার পরে পদ্ধতিটি কল করা হয়েছিল। |
ভিডিও বিজ্ঞাপন সক্ষম করুন
enableVideoAds ( ) : voidপাওয়া
get ( key : string ) : string- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.pubads().set("adsense_background_color", "#FFFFFF"); googletag.pubads().get("adsense_background_color"); // Returns '#FFFFFF'.
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.pubads().set("adsense_background_color", "#FFFFFF"); googletag.pubads().get("adsense_background_color"); // Returns '#FFFFFF'.
টাইপস্ক্রিপ্ট
googletag.pubads().set("adsense_background_color", "#FFFFFF"); googletag.pubads().get("adsense_background_color"); // Returns '#FFFFFF'.
- আরো দেখুন
| পরামিতি | |
|---|---|
key : string | যে বৈশিষ্ট্যটি খুঁজতে হবে তার নাম। |
| রিটার্নস | |
|---|---|
string | অ্যাট্রিবিউট কী-এর বর্তমান মান, অথবা কীটি উপস্থিত না থাকলে null । |
অ্যাট্রিবিউটকিস পান
getAttributeKeys ( ) : string []- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.pubads().set("adsense_background_color", "#FFFFFF"); googletag.pubads().set("adsense_border_color", "#AABBCC"); googletag.pubads().getAttributeKeys(); // Returns ['adsense_background_color', 'adsense_border_color'].
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.pubads().set("adsense_background_color", "#FFFFFF"); googletag.pubads().set("adsense_border_color", "#AABBCC"); googletag.pubads().getAttributeKeys(); // Returns ['adsense_background_color', 'adsense_border_color'].
টাইপস্ক্রিপ্ট
googletag.pubads().set("adsense_background_color", "#FFFFFF"); googletag.pubads().set("adsense_border_color", "#AABBCC"); googletag.pubads().getAttributeKeys(); // Returns ['adsense_background_color', 'adsense_border_color'].
| রিটার্নস | |
|---|---|
string [] | এই পরিষেবাতে সেট করা অ্যাট্রিবিউট কীগুলির অ্যারে। অর্ডারিং অনির্ধারিত। |
লক্ষ্য নির্ধারণ করা
getTargeting ( key : string ) : string []- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.pubads().setTargeting("interests", "sports"); googletag.pubads().getTargeting("interests"); // Returns ['sports']. googletag.pubads().getTargeting("age"); // Returns [] (empty array).
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.pubads().setTargeting("interests", "sports"); googletag.pubads().getTargeting("interests"); // Returns ['sports']. googletag.pubads().getTargeting("age"); // Returns [] (empty array).
টাইপস্ক্রিপ্ট
googletag.pubads().setTargeting("interests", "sports"); googletag.pubads().getTargeting("interests"); // Returns ['sports']. googletag.pubads().getTargeting("age"); // Returns [] (empty array).
| পরামিতি | |
|---|---|
key : string | লক্ষ্য নির্ধারণের চাবিকাঠি। |
| রিটার্নস | |
|---|---|
string [] | এই কী-এর সাথে সম্পর্কিত মান, অথবা যদি এমন কোনও কী না থাকে তবে একটি খালি অ্যারে। |
গেটটার্গেটিংকি
getTargetingKeys ( ) : string []- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.pubads().setTargeting("interests", "sports"); googletag.pubads().setTargeting("colors", "blue"); googletag.pubads().getTargetingKeys(); // Returns ['interests', 'colors'].
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.pubads().setTargeting("interests", "sports"); googletag.pubads().setTargeting("colors", "blue"); googletag.pubads().getTargetingKeys(); // Returns ['interests', 'colors'].
টাইপস্ক্রিপ্ট
googletag.pubads().setTargeting("interests", "sports"); googletag.pubads().setTargeting("colors", "blue"); googletag.pubads().getTargetingKeys(); // Returns ['interests', 'colors'].
| রিটার্নস | |
|---|---|
string [] | টার্গেটিং কীগুলির অ্যারে। অর্ডারিং অনির্ধারিত। |
প্রাথমিক লোড অক্ষম করা হয়েছে
isInitialLoadDisabled ( ) : boolean| রিটার্নস | |
|---|---|
boolean | PubAdsService.disableInitialLoad- এ পূর্ববর্তী কল সফল হলে true দেখায়, অন্যথায় false । |
রিফ্রেশ করুন
refresh ( slots ?: Slot [] , options ?: {
changeCorrelator : boolean ;
} ) : voidসকল ব্রাউজারে সঠিক আচরণের জন্য, বিজ্ঞাপন স্লট
display জন্য refresh কল করার আগে একটি কল করতে হবে। যদি display জন্য কল বাদ দেওয়া হয়, তাহলে রিফ্রেশ অপ্রত্যাশিতভাবে আচরণ করতে পারে। যদি ইচ্ছা হয়, তাহলে PubAdsService.disableInitialLoad পদ্ধতি ব্যবহার করে বিজ্ঞাপন display বন্ধ করা যেতে পারে।একটি স্লট রিফ্রেশ করলে GPT-এর দীর্ঘস্থায়ী পেজভিউ থেকে পুরানো বিজ্ঞাপনটি সরিয়ে ফেলা হয়, তাই ভবিষ্যতের অনুরোধগুলি সেই বিজ্ঞাপনের সাথে জড়িত বাধা বা প্রতিযোগিতামূলক বর্জনের দ্বারা প্রভাবিত হবে না।
- উদাহরণ
জাভাস্ক্রিপ্ট
const slot1 = googletag.defineSlot("/1234567/sports", [728, 90], "div-1"); googletag.display("div-1"); const slot2 = googletag.defineSlot("/1234567/news", [160, 600], "div-2"); googletag.display("div-2"); // This call to refresh fetches a new ad for slot1 only. googletag.pubads().refresh([slot1]); // This call to refresh fetches a new ad for both slot1 and slot2. googletag.pubads().refresh([slot1, slot2]); // This call to refresh fetches a new ad for each slot. googletag.pubads().refresh(); // This call to refresh fetches a new ad for slot1, without changing // the correlator. googletag.pubads().refresh([slot1], { changeCorrelator: false }); // This call to refresh fetches a new ad for each slot, without // changing the correlator. googletag.pubads().refresh(null, { changeCorrelator: false });
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
var slot1 = googletag.defineSlot("/1234567/sports", [728, 90], "div-1"); googletag.display("div-1"); var slot2 = googletag.defineSlot("/1234567/news", [160, 600], "div-2"); googletag.display("div-2"); // This call to refresh fetches a new ad for slot1 only. googletag.pubads().refresh([slot1]); // This call to refresh fetches a new ad for both slot1 and slot2. googletag.pubads().refresh([slot1, slot2]); // This call to refresh fetches a new ad for each slot. googletag.pubads().refresh(); // This call to refresh fetches a new ad for slot1, without changing // the correlator. googletag.pubads().refresh([slot1], { changeCorrelator: false }); // This call to refresh fetches a new ad for each slot, without // changing the correlator. googletag.pubads().refresh(null, { changeCorrelator: false });
টাইপস্ক্রিপ্ট
const slot1 = googletag.defineSlot("/1234567/sports", [728, 90], "div-1")!; googletag.display("div-1"); const slot2 = googletag.defineSlot("/1234567/news", [160, 600], "div-2")!; googletag.display("div-2"); // This call to refresh fetches a new ad for slot1 only. googletag.pubads().refresh([slot1]); // This call to refresh fetches a new ad for both slot1 and slot2. googletag.pubads().refresh([slot1, slot2]); // This call to refresh fetches a new ad for each slot. googletag.pubads().refresh(); // This call to refresh fetches a new ad for slot1, without changing // the correlator. googletag.pubads().refresh([slot1], { changeCorrelator: false }); // This call to refresh fetches a new ad for each slot, without // changing the correlator. googletag.pubads().refresh(null, { changeCorrelator: false });
| পরামিতি | |
|---|---|
| রিফ্রেশ করার জন্য স্লট। অ্যারে ঐচ্ছিক; যদি এটি নির্দিষ্ট না থাকে তবে সমস্ত স্লট রিফ্রেশ করা হবে। |
| এই রিফ্রেশ কলের সাথে সম্পর্কিত কনফিগারেশন বিকল্পগুলি।
|
সেট
set ( key : string , value : string ) : PubAdsServiceএকই কী-এর জন্য একাধিকবার এটি কল করলে সেই কী-এর জন্য পূর্বে সেট করা মানগুলি ওভাররাইড হবে।
display বা refresh কল করার আগে সমস্ত মান সেট করতে হবে।- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.pubads().set("adsense_background_color", "#FFFFFF");
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.pubads().set("adsense_background_color", "#FFFFFF");
টাইপস্ক্রিপ্ট
googletag.pubads().set("adsense_background_color", "#FFFFFF");
- আরো দেখুন
| পরামিতি | |
|---|---|
key : string | বৈশিষ্ট্যের নাম। |
value : string | বৈশিষ্ট্যের মান। |
| রিটার্নস | |
|---|---|
PubAdsService | যে পরিষেবা অবজেক্টে পদ্ধতিটি কল করা হয়েছিল। |
সেটবিভাগবর্জন
setCategoryExclusion ( categoryExclusion : string ) : PubAdsService- উদাহরণ
জাভাস্ক্রিপ্ট
// Label = AirlineAd. googletag.pubads().setCategoryExclusion("AirlineAd");
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
// Label = AirlineAd. googletag.pubads().setCategoryExclusion("AirlineAd");
টাইপস্ক্রিপ্ট
// Label = AirlineAd. googletag.pubads().setCategoryExclusion("AirlineAd");
- আরো দেখুন
| পরামিতি | |
|---|---|
categoryExclusion : string | যোগ করার জন্য বিজ্ঞাপন বিভাগ বর্জন লেবেল। |
| রিটার্নস | |
|---|---|
PubAdsService | যে পরিষেবা অবজেক্টে পদ্ধতিটি কল করা হয়েছিল। |
সেটসেন্টারিং
setCentering ( centerAds : boolean ) : voidএই পদ্ধতিটি
display বা refresh কল করার আগে ব্যবহার করা উচিত কারণ এই পদ্ধতিতে কল করার পরে অনুরোধ করা বিজ্ঞাপনগুলিই কেবল কেন্দ্রীভূত হবে।- উদাহরণ
জাভাস্ক্রিপ্ট
// Make ads centered. googletag.pubads().setCentering(true);
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
// Make ads centered. googletag.pubads().setCentering(true);
টাইপস্ক্রিপ্ট
// Make ads centered. googletag.pubads().setCentering(true);
| পরামিতি | |
|---|---|
centerAds : boolean | কেন্দ্রের বিজ্ঞাপনের ক্ষেত্রে true , বাম দিকে সারিবদ্ধ করতে false । |
সেটফোর্সসেফফ্রেম
setForceSafeFrame ( forceSafeFrame : boolean ) : PubAdsServiceএই API ব্যবহার করার সময় নিম্নলিখিত বিষয়গুলি মনে রাখবেন:
- এই সেটিংটি শুধুমাত্র সংশ্লিষ্ট স্লটের জন্য পরবর্তী বিজ্ঞাপনের অনুরোধের ক্ষেত্রে কার্যকর হবে।
- স্লট লেভেল সেটিং, যদি নির্দিষ্ট করা থাকে, তাহলে সর্বদা পৃষ্ঠা লেভেল সেটিংকে ওভাররাইড করবে।
- যদি
trueহিসেবে সেট করা থাকে (স্লট-লেভেল বা পৃষ্ঠা স্তরে), তাহলে বিজ্ঞাপনটি সর্বদা একটি সেফফ্রেম কন্টেইনার ব্যবহার করে রেন্ডার করা হবে, যা Google বিজ্ঞাপন ম্যানেজার UI-তে করা পছন্দের উপর নির্ভর করবে না। - তবে, যদি
falseসেট করা থাকে বা নির্দিষ্ট না করে রাখা হয়, তাহলে বিজ্ঞাপনটি একটি সেফফ্রেম কন্টেইনার ব্যবহার করে রেন্ডার করা হবে যা ক্রিয়েটিভের ধরণ এবং Google বিজ্ঞাপন ম্যানেজার UI-তে করা নির্বাচনের উপর নির্ভর করে। - এই APIটি সাবধানতার সাথে ব্যবহার করা উচিত কারণ এটি তাদের আইফ্রেম থেকে বেরিয়ে আসার চেষ্টা করে এমন সৃজনশীলদের আচরণের উপর প্রভাব ফেলতে পারে অথবা প্রকাশকদের পৃষ্ঠায় সরাসরি রেন্ডার করার উপর নির্ভর করতে পারে।
- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.pubads().setForceSafeFrame(true); // The following slot will be opted-out of the page-level force // SafeFrame instruction. googletag .defineSlot("/1234567/sports", [160, 600], "div-1") .setForceSafeFrame(false) .addService(googletag.pubads()); // The following slot will have SafeFrame forced. googletag.defineSlot("/1234567/news", [160, 600], "div-2").addService(googletag.pubads()); googletag.display("div-1"); googletag.display("div-2");
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.pubads().setForceSafeFrame(true); // The following slot will be opted-out of the page-level force // SafeFrame instruction. googletag .defineSlot("/1234567/sports", [160, 600], "div-1") .setForceSafeFrame(false) .addService(googletag.pubads()); // The following slot will have SafeFrame forced. googletag.defineSlot("/1234567/news", [160, 600], "div-2").addService(googletag.pubads()); googletag.display("div-1"); googletag.display("div-2");
টাইপস্ক্রিপ্ট
googletag.pubads().setForceSafeFrame(true); // The following slot will be opted-out of the page-level force // SafeFrame instruction. googletag .defineSlot("/1234567/sports", [160, 600], "div-1")! .setForceSafeFrame(false) .addService(googletag.pubads()); // The following slot will have SafeFrame forced. googletag.defineSlot("/1234567/news", [160, 600], "div-2")!.addService(googletag.pubads()); googletag.display("div-1"); googletag.display("div-2");
| পরামিতি | |
|---|---|
forceSafeFrame : boolean | পৃষ্ঠার সমস্ত বিজ্ঞাপনকে সেফফ্রেমে রেন্ডার করতে বাধ্য করার জন্য true এবং পূর্ববর্তী সেটিংটিকে false এ পরিবর্তন করার জন্য false । আগে নির্দিষ্ট না করা থাকলে এটি false এ সেট করলেও কোনও পরিবর্তন হবে না। |
| রিটার্নস | |
|---|---|
PubAdsService | যে পরিষেবা অবজেক্টে পদ্ধতিটি কল করা হয়েছিল। |
অবস্থান সেট করুন
setLocation ( address : string ) : PubAdsService- উদাহরণ
জাভাস্ক্রিপ্ট
// Postal code: googletag.pubads().setLocation("10001,US");
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
// Postal code: googletag.pubads().setLocation("10001,US");
টাইপস্ক্রিপ্ট
// Postal code: googletag.pubads().setLocation("10001,US");
| পরামিতি | |
|---|---|
address : string | ফ্রিফর্ম ঠিকানা। |
| রিটার্নস | |
|---|---|
PubAdsService | যে পরিষেবা অবজেক্টে পদ্ধতিটি কল করা হয়েছিল। |
গোপনীয়তা সেটিংস সেট করুন
setPrivacySettings ( privacySettings : PrivacySettingsConfig ) : PubAdsService- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.pubads().setPrivacySettings({ restrictDataProcessing: true, }); // Set multiple privacy settings at the same time. googletag.pubads().setPrivacySettings({ childDirectedTreatment: true, underAgeOfConsent: true, }); // Clear the configuration for childDirectedTreatment. googletag.pubads().setPrivacySettings({ childDirectedTreatment: null, });
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.pubads().setPrivacySettings({ restrictDataProcessing: true, }); // Set multiple privacy settings at the same time. googletag.pubads().setPrivacySettings({ childDirectedTreatment: true, underAgeOfConsent: true, }); // Clear the configuration for childDirectedTreatment. googletag.pubads().setPrivacySettings({ childDirectedTreatment: null, });
টাইপস্ক্রিপ্ট
googletag.pubads().setPrivacySettings({ restrictDataProcessing: true, }); // Set multiple privacy settings at the same time. googletag.pubads().setPrivacySettings({ childDirectedTreatment: true, underAgeOfConsent: true, }); // Clear the configuration for childDirectedTreatment. googletag.pubads().setPrivacySettings({ childDirectedTreatment: null, });
| পরামিতি | |
|---|---|
privacySettings : PrivacySettingsConfig | গোপনীয়তা সেটিংস কনফিগারেশন ধারণকারী বস্তু। |
| রিটার্নস | |
|---|---|
PubAdsService | যে পরিষেবা অবজেক্টে ফাংশনটি কল করা হয়েছিল। |
সেটপ্রকাশকপ্রদত্তআইডি
setPublisherProvidedId ( ppid : string ) : PubAdsService- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.pubads().setPublisherProvidedId("12JD92JD8078S8J29SDOAKC0EF230337");
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.pubads().setPublisherProvidedId("12JD92JD8078S8J29SDOAKC0EF230337");
টাইপস্ক্রিপ্ট
googletag.pubads().setPublisherProvidedId("12JD92JD8078S8J29SDOAKC0EF230337");
- আরো দেখুন
| পরামিতি | |
|---|---|
ppid : string | প্রকাশকের দেওয়া একটি বর্ণসাংখ্যিক আইডি। ৩২ থেকে ১৫০ অক্ষরের মধ্যে হতে হবে। |
| রিটার্নস | |
|---|---|
PubAdsService | যে পরিষেবা অবজেক্টে পদ্ধতিটি কল করা হয়েছিল। |
সেটসেফফ্রেমকনফিগ
setSafeFrameConfig ( config : SafeFrameConfig ) : PubAdsServiceএই পৃষ্ঠা-স্তরের পছন্দগুলি স্লট-স্তরের পছন্দগুলি দ্বারা ওভাররাইড করা হবে, যদি নির্দিষ্ট করা থাকে।
- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.pubads().setForceSafeFrame(true); const pageConfig = { allowOverlayExpansion: true, allowPushExpansion: true, sandbox: true, }; const slotConfig = { allowOverlayExpansion: false }; googletag.pubads().setSafeFrameConfig(pageConfig); // The following slot will not allow for expansion by overlay. googletag .defineSlot("/1234567/sports", [160, 600], "div-1") .setSafeFrameConfig(slotConfig) .addService(googletag.pubads()); // The following slot will inherit the page level settings, and hence // would allow for expansion by overlay. googletag.defineSlot("/1234567/news", [160, 600], "div-2").addService(googletag.pubads()); googletag.display("div-1"); googletag.display("div-2");
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
googletag.pubads().setForceSafeFrame(true); var pageConfig = { allowOverlayExpansion: true, allowPushExpansion: true, sandbox: true, }; var slotConfig = { allowOverlayExpansion: false }; googletag.pubads().setSafeFrameConfig(pageConfig); // The following slot will not allow for expansion by overlay. googletag .defineSlot("/1234567/sports", [160, 600], "div-1") .setSafeFrameConfig(slotConfig) .addService(googletag.pubads()); // The following slot will inherit the page level settings, and hence // would allow for expansion by overlay. googletag.defineSlot("/1234567/news", [160, 600], "div-2").addService(googletag.pubads()); googletag.display("div-1"); googletag.display("div-2");
টাইপস্ক্রিপ্ট
googletag.pubads().setForceSafeFrame(true); const pageConfig = { allowOverlayExpansion: true, allowPushExpansion: true, sandbox: true, }; const slotConfig = { allowOverlayExpansion: false }; googletag.pubads().setSafeFrameConfig(pageConfig); // The following slot will not allow for expansion by overlay. googletag .defineSlot("/1234567/sports", [160, 600], "div-1")! .setSafeFrameConfig(slotConfig) .addService(googletag.pubads()); // The following slot will inherit the page level settings, and hence // would allow for expansion by overlay. googletag.defineSlot("/1234567/news", [160, 600], "div-2")!.addService(googletag.pubads()); googletag.display("div-1"); googletag.display("div-2");
| পরামিতি | |
|---|---|
config : SafeFrameConfig | কনফিগারেশন অবজেক্ট। |
| রিটার্নস | |
|---|---|
PubAdsService | যে পরিষেবা অবজেক্টে পদ্ধতিটি কল করা হয়েছিল। |
সেট টার্গেটিং
setTargeting ( key : string , value : string | string [] ) : PubAdsService- উদাহরণ
জাভাস্ক্রিপ্ট
// Example with a single value for a key. googletag.pubads().setTargeting("interests", "sports"); // Example with multiple values for a key inside in an array. googletag.pubads().setTargeting("interests", ["sports", "music"]);
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
// Example with a single value for a key. googletag.pubads().setTargeting("interests", "sports"); // Example with multiple values for a key inside in an array. googletag.pubads().setTargeting("interests", ["sports", "music"]);
টাইপস্ক্রিপ্ট
// Example with a single value for a key. googletag.pubads().setTargeting("interests", "sports"); // Example with multiple values for a key inside in an array. googletag.pubads().setTargeting("interests", ["sports", "music"]);
- আরো দেখুন
| পরামিতি | |
|---|---|
key : string | টার্গেটিং প্যারামিটার কী। |
value : string | string [] | লক্ষ্যবস্তু প্যারামিটার মান বা মানের অ্যারে। |
| রিটার্নস | |
|---|---|
PubAdsService | যে পরিষেবা অবজেক্টে পদ্ধতিটি কল করা হয়েছিল। |
সেটভিডিওকন্টেন্ট
setVideoContent ( videoContentId : string , videoCmsId : string ) : voidvideoContentId এবং videoCmsId জন্য, Google Ad Manager কন্টেন্ট ইনজেশন পরিষেবাতে প্রদত্ত মানগুলি ব্যবহার করুন।- আরো দেখুন
| পরামিতি | |
|---|---|
videoContentId : string | ভিডিও কন্টেন্ট আইডি। |
videoCmsId : string | ভিডিও সিএমএস আইডি। |
আপডেটসংযোগকারী
updateCorrelator ( ) : PubAdsServiceদ্রষ্টব্য: এর ফলে GPT-এর দীর্ঘস্থায়ী পেজভিউ-এর উপর কোনও প্রভাব পড়ে না, যা স্বয়ংক্রিয়ভাবে পৃষ্ঠায় থাকা বিজ্ঞাপনগুলিকে প্রতিফলিত করে এবং এর কোনও মেয়াদ শেষ হওয়ার সময় থাকে না।
- উদাহরণ
জাভাস্ক্রিপ্ট
// Assume that the correlator is currently 12345. All ad requests made // by this page will currently use that value. // Replace the current correlator with a new correlator. googletag.pubads().updateCorrelator(); // The correlator will now be a new randomly selected value, different // from 12345. All subsequent ad requests made by this page will use // the new value.
জাভাস্ক্রিপ্ট (উত্তরাধিকার)
// Assume that the correlator is currently 12345. All ad requests made // by this page will currently use that value. // Replace the current correlator with a new correlator. googletag.pubads().updateCorrelator(); // The correlator will now be a new randomly selected value, different // from 12345. All subsequent ad requests made by this page will use // the new value.
টাইপস্ক্রিপ্ট
// Assume that the correlator is currently 12345. All ad requests made // by this page will currently use that value. // Replace the current correlator with a new correlator. googletag.pubads().updateCorrelator(); // The correlator will now be a new randomly selected value, different // from 12345. All subsequent ad requests made by this page will use // the new value.
| রিটার্নস | |
|---|---|
PubAdsService | যে পরিষেবা অবজেক্টে ফাংশনটি কল করা হয়েছিল। |
গুগলট্যাগ.প্রতিক্রিয়া তথ্য
| বৈশিষ্ট্য | |
|---|---|
advertiser Id | বিজ্ঞাপনদাতার আইডি। |
campaign Id | প্রচারণার আইডি। |
creative Id | সৃজনশীলের আইডি। |
creative Template Id | বিজ্ঞাপনের টেমপ্লেট আইডি। |
line Item Id | লাইন আইটেমের আইডি। |
- আরো দেখুন
বৈশিষ্ট্য
বিজ্ঞাপনদাতার আইডি
advertiserId : numberপ্রচারণা আইডি
campaignId : numberসৃজনশীল আইডি
creativeId : numberসৃজনশীল টেমপ্লেট আইডি
creativeTemplateId : numberলাইনআইটিমআইডি
lineItemId : numberগুগলট্যাগ। রিওয়ার্ডেডপেলোড
| বৈশিষ্ট্য | |
|---|---|
amount | পুরষ্কারে অন্তর্ভুক্ত আইটেমের সংখ্যা। |
type | পুরষ্কারে অন্তর্ভুক্ত আইটেমের ধরণ (উদাহরণস্বরূপ, "মুদ্রা")। |
- আরো দেখুন
বৈশিষ্ট্য
পরিমাণ
amount : numberটাইপ করুন
type : stringগুগলট্যাগ.সার্ভিস
| পদ্ধতি | |
|---|---|
add Event Listener | একটি লিসেনার নিবন্ধন করে যা আপনাকে পৃষ্ঠায় একটি নির্দিষ্ট GPT ইভেন্ট ঘটলে একটি জাভাস্ক্রিপ্ট ফাংশন সেট আপ এবং কল করতে দেয়। |
get Slots | এই পরিষেবার সাথে সম্পর্কিত স্লটগুলির তালিকা পান। |
remove Event Listener | পূর্বে নিবন্ধিত শ্রোতাকে সরিয়ে দেয়। |
পদ্ধতি
অ্যাডইভেন্টলিস্টনার
addEventListener < K extends keyof EventTypeMap > ( eventType : K , listener : ( ( arg : EventTypeMap [ K ] ) => void ) ) : Service- ইভেন্ট।গেমম্যানুয়ালইন্টারস্টিশিয়ালস্লটক্লোজডইভেন্ট
- events.GameManualInterstitialSlotReadyEvent
- events.ImpressionViewableEvent
- events.RewardedSlotClosedEvent
- events.RewardedSlotGrantedEvent
- events.RewardedSlotReadyEvent
- events.SlotOnloadEvent
- events.SlotRenderEndedEvent
- events.SlotRequestedEvent
- events.SlotResponseReceived
- events.SlotVisibilityChangedEvent
- উদাহরণ
জাভাস্ক্রিপ্ট
// 1. Adding an event listener for the PubAdsService. googletag.pubads().addEventListener("slotOnload", (event) => { console.log("Slot has been loaded:"); console.log(event); }); // 2. Adding an event listener with slot specific logic. // Listeners operate at service level, which means that you cannot add // a listener for an event for a specific slot only. You can, however, // programmatically filter a listener to respond only to a certain ad // slot, using this pattern: const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotOnload", (event) => { if (event.slot === targetSlot) { // Slot specific logic. } });
JavaScript (legacy)
// 1. Adding an event listener for the PubAdsService. googletag.pubads().addEventListener("slotOnload", function (event) { console.log("Slot has been loaded:"); console.log(event); }); // 2. Adding an event listener with slot specific logic. // Listeners operate at service level, which means that you cannot add // a listener for an event for a specific slot only. You can, however, // programmatically filter a listener to respond only to a certain ad // slot, using this pattern: var targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotOnload", function (event) { if (event.slot === targetSlot) { // Slot specific logic. } });
টাইপস্ক্রিপ্ট
// 1. Adding an event listener for the PubAdsService. googletag.pubads().addEventListener("slotOnload", (event) => { console.log("Slot has been loaded:"); console.log(event); }); // 2. Adding an event listener with slot specific logic. // Listeners operate at service level, which means that you cannot add // a listener for an event for a specific slot only. You can, however, // programmatically filter a listener to respond only to a certain ad // slot, using this pattern: const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotOnload", (event) => { if (event.slot === targetSlot) { // Slot specific logic. } });
- আরো দেখুন
| পরামিতি | |
|---|---|
eventType : K | A string representing the type of event generated by GPT. Event types are case sensitive. |
listener : ( ( arg : EventTypeMap [ K ] ) => void ) | Function that takes a single event object argument. |
| রিটার্নস | |
|---|---|
Service | The service object on which the method was called. |
getSlots
removeEventListener
removeEventListener < K extends keyof EventTypeMap > ( eventType : K , listener : ( ( event : EventTypeMap [ K ] ) => void ) ) : void- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.cmd.push(() => { // Define a new ad slot. googletag.defineSlot("/6355419/Travel", [728, 90], "div-for-slot").addService(googletag.pubads()); // Define a new function that removes itself via removeEventListener // after the impressionViewable event fires. const onViewableListener = (event) => { googletag.pubads().removeEventListener("impressionViewable", onViewableListener); setTimeout(() => { googletag.pubads().refresh([event.slot]); }, 30000); }; // Add onViewableListener as a listener for impressionViewable events. googletag.pubads().addEventListener("impressionViewable", onViewableListener); googletag.enableServices(); });
JavaScript (legacy)
googletag.cmd.push(function () { // Define a new ad slot. googletag.defineSlot("/6355419/Travel", [728, 90], "div-for-slot").addService(googletag.pubads()); // Define a new function that removes itself via removeEventListener // after the impressionViewable event fires. var onViewableListener = function (event) { googletag.pubads().removeEventListener("impressionViewable", onViewableListener); setTimeout(function () { googletag.pubads().refresh([event.slot]); }, 30000); }; // Add onViewableListener as a listener for impressionViewable events. googletag.pubads().addEventListener("impressionViewable", onViewableListener); googletag.enableServices(); });
টাইপস্ক্রিপ্ট
googletag.cmd.push(() => { // Define a new ad slot. googletag .defineSlot("/6355419/Travel", [728, 90], "div-for-slot")! .addService(googletag.pubads()); // Define a new function that removes itself via removeEventListener // after the impressionViewable event fires. const onViewableListener = (event: googletag.events.ImpressionViewableEvent) => { googletag.pubads().removeEventListener("impressionViewable", onViewableListener); setTimeout(() => { googletag.pubads().refresh([event.slot]); }, 30000); }; // Add onViewableListener as a listener for impressionViewable events. googletag.pubads().addEventListener("impressionViewable", onViewableListener); googletag.enableServices(); });
| পরামিতি | |
|---|---|
eventType : K | A string representing the type of event generated by GPT. Event types are case sensitive. |
listener : ( ( event : EventTypeMap [ K ] ) => void ) | Function that takes a single event object argument. |
googletag.SizeMappingBuilder
| পদ্ধতি | |
|---|---|
add Size | Adds a mapping from a single-size array (representing the viewport) to a single- or multi-size array representing the slot. |
build | Builds a size map specification from the mappings added to this builder. |
- আরো দেখুন
পদ্ধতি
addSize
addSize ( viewportSize : SingleSizeArray , slotSize : GeneralSize ) : SizeMappingBuilder- উদাহরণ
জাভাস্ক্রিপ্ট
// Mapping 1 googletag .sizeMapping() .addSize([1024, 768], [970, 250]) .addSize([980, 690], [728, 90]) .addSize([640, 480], "fluid") .addSize([0, 0], [88, 31]) // All viewports < 640x480 .build(); // Mapping 2 googletag .sizeMapping() .addSize([1024, 768], [970, 250]) .addSize([980, 690], []) .addSize([640, 480], [120, 60]) .addSize([0, 0], []) .build(); // Mapping 2 will not show any ads for the following viewport sizes: // [1024, 768] > size >= [980, 690] and // [640, 480] > size >= [0, 0]
JavaScript (legacy)
// Mapping 1 googletag .sizeMapping() .addSize([1024, 768], [970, 250]) .addSize([980, 690], [728, 90]) .addSize([640, 480], "fluid") .addSize([0, 0], [88, 31]) // All viewports < 640x480 .build(); // Mapping 2 googletag .sizeMapping() .addSize([1024, 768], [970, 250]) .addSize([980, 690], []) .addSize([640, 480], [120, 60]) .addSize([0, 0], []) .build(); // Mapping 2 will not show any ads for the following viewport sizes: // [1024, 768] > size >= [980, 690] and // [640, 480] > size >= [0, 0]
টাইপস্ক্রিপ্ট
// Mapping 1 googletag .sizeMapping() .addSize([1024, 768], [970, 250]) .addSize([980, 690], [728, 90]) .addSize([640, 480], "fluid") .addSize([0, 0], [88, 31]) // All viewports < 640x480 .build(); // Mapping 2 googletag .sizeMapping() .addSize([1024, 768], [970, 250]) .addSize([980, 690], []) .addSize([640, 480], [120, 60]) .addSize([0, 0], []) .build(); // Mapping 2 will not show any ads for the following viewport sizes: // [1024, 768] > size >= [980, 690] and // [640, 480] > size >= [0, 0]
| পরামিতি | |
|---|---|
viewportSize : SingleSizeArray | The size of the viewport for this mapping entry. |
slotSize : GeneralSize | The sizes of the slot for this mapping entry. |
| রিটার্নস | |
|---|---|
SizeMappingBuilder | A reference to this builder. |
নির্মাণ করা
build ( ) : SizeMappingArrayIf any invalid mappings have been supplied, this method will return
null . Otherwise it returns a specification in the correct format to pass to Slot.defineSizeMapping .Note: the behavior of the builder after calling this method is undefined.
| রিটার্নস | |
|---|---|
SizeMappingArray | The result built by this builder. Can be null if invalid size mappings were supplied. |
googletag.Slot
| পদ্ধতি | |
|---|---|
add Service | Adds a Service to this slot. |
clear Category Exclusions | Deprecated. Clears all slot-level ad category exclusion labels for this slot. |
clear Targeting | Deprecated. Clears specific or all custom slot-level targeting parameters for this slot. |
define Size Mapping | Sets an array of mappings from a minimum viewport size to slot size for this slot. |
get | Deprecated. Returns the value for the AdSense attribute associated with the given key for this slot. |
get Ad Unit Path | Returns the full path of the ad unit, with the network code and ad unit path. |
get Attribute Keys | Deprecated. Returns the list of attribute keys set on this slot. |
get Category Exclusions | Deprecated. Returns the ad category exclusion labels for this slot. |
get Config | Gets general configuration options for the slot set by setConfig . |
get Response Information | Returns the ad response information. |
get Slot Element Id | Returns the ID of the slot div provided when the slot was defined. |
get Targeting | Deprecated. Returns a specific custom targeting parameter set on this slot. |
get Targeting Keys | Deprecated. Returns the list of all custom targeting keys set on this slot. |
set | Deprecated. Sets a value for an AdSense attribute on this ad slot. |
set Category Exclusion | Deprecated. Sets a slot-level ad category exclusion label on this slot. |
set Click Url | Deprecated. Sets the click URL to which users will be redirected after clicking on the ad. |
set Collapse Empty Div | Deprecated. Sets whether the slot div should be hidden when there is no ad in the slot. |
set Config | Sets general configuration options for this slot. |
set Force Safe Frame | Deprecated. Configures whether ads in this slot should be forced to be rendered using a SafeFrame container. |
set Safe Frame Config | Deprecated. Sets the slot-level preferences for SafeFrame configuration. |
set Targeting | Deprecated. Sets a custom targeting parameter for this slot. |
update Targeting From Map | Deprecated. Sets custom targeting parameters for this slot, from a key:value map in a JSON object. |
পদ্ধতি
addService
addService ( service : Service ) : Slot- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.defineSlot("/1234567/sports", [160, 600], "div").addService(googletag.pubads());
JavaScript (legacy)
googletag.defineSlot("/1234567/sports", [160, 600], "div").addService(googletag.pubads());
টাইপস্ক্রিপ্ট
googletag.defineSlot("/1234567/sports", [160, 600], "div")!.addService(googletag.pubads());
| পরামিতি | |
|---|---|
service : Service | The service to be added. |
| রিটার্নস | |
|---|---|
Slot | The slot object on which the method was called. |
clearCategoryExclusions
clearCategoryExclusions ( ) : Slot- উদাহরণ
জাভাস্ক্রিপ্ট
// Set category exclusion to exclude ads with 'AirlineAd' labels. const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .setCategoryExclusion("AirlineAd") .addService(googletag.pubads()); // Make an ad request. No ad with 'AirlineAd' label will be returned // for the slot. // Clear category exclusions so all ads can be returned. slot.clearCategoryExclusions(); // Make an ad request. Any ad can be returned for the slot.
JavaScript (legacy)
// Set category exclusion to exclude ads with 'AirlineAd' labels. var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .setCategoryExclusion("AirlineAd") .addService(googletag.pubads()); // Make an ad request. No ad with 'AirlineAd' label will be returned // for the slot. // Clear category exclusions so all ads can be returned. slot.clearCategoryExclusions(); // Make an ad request. Any ad can be returned for the slot.
টাইপস্ক্রিপ্ট
// Set category exclusion to exclude ads with 'AirlineAd' labels. const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .setCategoryExclusion("AirlineAd") .addService(googletag.pubads()); // Make an ad request. No ad with 'AirlineAd' label will be returned // for the slot. // Clear category exclusions so all ads can be returned. slot.clearCategoryExclusions(); // Make an ad request. Any ad can be returned for the slot.
| রিটার্নস | |
|---|---|
Slot | The slot object on which the method was called. |
clearTargeting
clearTargeting ( key ?: string ) : Slot- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .setTargeting("allow_expandable", "true") .setTargeting("interests", ["sports", "music"]) .setTargeting("color", "red") .addService(googletag.pubads()); slot.clearTargeting("color"); // Targeting 'allow_expandable' and 'interests' are still present, // while 'color' was cleared. slot.clearTargeting(); // All targeting has been cleared.
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .setTargeting("allow_expandable", "true") .setTargeting("interests", ["sports", "music"]) .setTargeting("color", "red") .addService(googletag.pubads()); slot.clearTargeting("color"); // Targeting 'allow_expandable' and 'interests' are still present, // while 'color' was cleared. slot.clearTargeting(); // All targeting has been cleared.
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .setTargeting("allow_expandable", "true") .setTargeting("interests", ["sports", "music"]) .setTargeting("color", "red") .addService(googletag.pubads()); slot.clearTargeting("color"); // Targeting 'allow_expandable' and 'interests' are still present, // while 'color' was cleared. slot.clearTargeting(); // All targeting has been cleared.
- আরো দেখুন
| পরামিতি | |
|---|---|
| Targeting parameter key. The key is optional; all targeting parameters will be cleared if it is unspecified. |
| রিটার্নস | |
|---|---|
Slot | The slot object on which the method was called. |
defineSizeMapping
defineSizeMapping ( sizeMapping : SizeMappingArray ) : Slot- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); const mapping = googletag .sizeMapping() .addSize([100, 100], [88, 31]) .addSize( [320, 400], [ [320, 50], [300, 50], ], ) .build(); slot.defineSizeMapping(mapping);
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); var mapping = googletag .sizeMapping() .addSize([100, 100], [88, 31]) .addSize( [320, 400], [ [320, 50], [300, 50], ], ) .build(); slot.defineSizeMapping(mapping);
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .addService(googletag.pubads()); const mapping = googletag .sizeMapping() .addSize([100, 100], [88, 31]) .addSize( [320, 400], [ [320, 50], [300, 50], ], ) .build(); slot.defineSizeMapping(mapping!);
- আরো দেখুন
| পরামিতি | |
|---|---|
sizeMapping : SizeMappingArray | Array of size mappings. You can use SizeMappingBuilder to create it. Each size mapping is an array of two elements: SingleSizeArray and GeneralSize . |
| রিটার্নস | |
|---|---|
Slot | The slot object on which the method was called. |
পাওয়া
get ( key : string ) : string- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .set("adsense_background_color", "#FFFFFF") .addService(googletag.pubads()); slot.get("adsense_background_color"); // Returns '#FFFFFF'.
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .set("adsense_background_color", "#FFFFFF") .addService(googletag.pubads()); slot.get("adsense_background_color"); // Returns '#FFFFFF'.
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .set("adsense_background_color", "#FFFFFF") .addService(googletag.pubads()); slot.get("adsense_background_color"); // Returns '#FFFFFF'.
- আরো দেখুন
| পরামিতি | |
|---|---|
key : string | Name of the attribute to look for. |
| রিটার্নস | |
|---|---|
string | Current value for the attribute key, or null if the key is not present. |
getAdUnitPath
getAdUnitPath ( ) : string- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); slot.getAdUnitPath(); // Returns '/1234567/sports'.
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); slot.getAdUnitPath(); // Returns '/1234567/sports'.
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .addService(googletag.pubads()); slot.getAdUnitPath(); // Returns '/1234567/sports'.
| রিটার্নস | |
|---|---|
string | Ad unit path. |
getAttributeKeys
getAttributeKeys ( ) : string []- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .set("adsense_background_color", "#FFFFFF") .set("adsense_border_color", "#AABBCC") .addService(googletag.pubads()); slot.getAttributeKeys(); // Returns ['adsense_background_color', 'adsense_border_color'].
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .set("adsense_background_color", "#FFFFFF") .set("adsense_border_color", "#AABBCC") .addService(googletag.pubads()); slot.getAttributeKeys(); // Returns ['adsense_background_color', 'adsense_border_color'].
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .set("adsense_background_color", "#FFFFFF") .set("adsense_border_color", "#AABBCC") .addService(googletag.pubads()); slot.getAttributeKeys(); // Returns ['adsense_background_color', 'adsense_border_color'].
| রিটার্নস | |
|---|---|
string [] | Array of attribute keys. Ordering is undefined. |
getCategoryExclusions
getCategoryExclusions ( ) : string []- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .setCategoryExclusion("AirlineAd") .setCategoryExclusion("TrainAd") .addService(googletag.pubads()); slot.getCategoryExclusions(); // Returns ['AirlineAd', 'TrainAd'].
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .setCategoryExclusion("AirlineAd") .setCategoryExclusion("TrainAd") .addService(googletag.pubads()); slot.getCategoryExclusions(); // Returns ['AirlineAd', 'TrainAd'].
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .setCategoryExclusion("AirlineAd") .setCategoryExclusion("TrainAd") .addService(googletag.pubads()); slot.getCategoryExclusions(); // Returns ['AirlineAd', 'TrainAd'].
| রিটার্নস | |
|---|---|
string [] | The ad category exclusion labels for this slot, or an empty array if none have been set. |
getConfig
getConfig ( keys : string | string [] ) : Pick < SlotSettingsConfig , "adsenseAttributes" | "targeting" | "categoryExclusion" >Not all
setConfig() properties are supported by this method. Supported properties are:- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag.defineSlot("/1234567/sports", [160, 600], "div"); // Get the value of the `targeting` setting. const targetingConfig = slot.getConfig("targeting"); // Get the value of the `adsenseAttributes` and `categoryExclusion` settings. const config = slot.getConfig(["adsenseAttributes", "categoryExclusion"]);
JavaScript (legacy)
var slot = googletag.defineSlot("/1234567/sports", [160, 600], "div"); // Get the value of the `targeting` setting. var targetingConfig = slot.getConfig("targeting"); // Get the value of the `adsenseAttributes` and `categoryExclusion` settings. var config = slot.getConfig(["adsenseAttributes", "categoryExclusion"]);
টাইপস্ক্রিপ্ট
const slot = googletag.defineSlot("/1234567/sports", [160, 600], "div")!; // Get the value of the `targeting` setting. const targetingConfig = slot.getConfig("targeting"); // Get the value of the `adsenseAttributes` and `categoryExclusion` settings. const config = slot.getConfig(["adsenseAttributes", "categoryExclusion"]);
| পরামিতি | |
|---|---|
keys : string | string [] | The keys of the configuration options to get. |
| রিটার্নস | |
|---|---|
Pick < SlotSettingsConfig , "adsenseAttributes" | "targeting" | "categoryExclusion" > | The configuration options for the slot. |
getResponseInformation
getResponseInformation ( ) : ResponseInformationnull will be returned. | রিটার্নস | |
|---|---|
ResponseInformation | The latest ad response information, or null if the slot has no ad. |
getSlotElementId
getSlotElementId ( ) : stringdiv provided when the slot was defined.- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); slot.getSlotElementId(); // Returns 'div'.
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); slot.getSlotElementId(); // Returns 'div'.
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .addService(googletag.pubads()); slot.getSlotElementId(); // Returns 'div'.
| রিটার্নস | |
|---|---|
string | Slot div ID. |
getTargeting
getTargeting ( key : string ) : string []- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .setTargeting("allow_expandable", "true") .addService(googletag.pubads()); slot.getTargeting("allow_expandable"); // Returns ['true']. slot.getTargeting("age"); // Returns [] (empty array).
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .setTargeting("allow_expandable", "true") .addService(googletag.pubads()); slot.getTargeting("allow_expandable"); // Returns ['true']. slot.getTargeting("age"); // Returns [] (empty array).
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .setTargeting("allow_expandable", "true") .addService(googletag.pubads()); slot.getTargeting("allow_expandable"); // Returns ['true']. slot.getTargeting("age"); // Returns [] (empty array).
| পরামিতি | |
|---|---|
key : string | The targeting key to look for. |
| রিটার্নস | |
|---|---|
string [] | The values associated with this key, or an empty array if there is no such key. |
getTargetingKeys
getTargetingKeys ( ) : string []- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .setTargeting("allow_expandable", "true") .setTargeting("interests", ["sports", "music"]) .addService(googletag.pubads()); slot.getTargetingKeys(); // Returns ['interests', 'allow_expandable'].
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .setTargeting("allow_expandable", "true") .setTargeting("interests", ["sports", "music"]) .addService(googletag.pubads()); slot.getTargetingKeys(); // Returns ['interests', 'allow_expandable'].
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .setTargeting("allow_expandable", "true") .setTargeting("interests", ["sports", "music"]) .addService(googletag.pubads()); slot.getTargetingKeys(); // Returns ['interests', 'allow_expandable'].
| রিটার্নস | |
|---|---|
string [] | Array of targeting keys. Ordering is undefined. |
সেট
set ( key : string , value : string ) : SlotCalling this method more than once for the same key will override previously set values for that key. All values must be set before calling
display or refresh .- উদাহরণ
জাভাস্ক্রিপ্ট
// Setting an attribute on a single ad slot. googletag .defineSlot("/1234567/sports", [160, 600], "div") .set("adsense_background_color", "#FFFFFF") .addService(googletag.pubads());
JavaScript (legacy)
// Setting an attribute on a single ad slot. googletag .defineSlot("/1234567/sports", [160, 600], "div") .set("adsense_background_color", "#FFFFFF") .addService(googletag.pubads());
টাইপস্ক্রিপ্ট
// Setting an attribute on a single ad slot. googletag .defineSlot("/1234567/sports", [160, 600], "div")! .set("adsense_background_color", "#FFFFFF") .addService(googletag.pubads());
- আরো দেখুন
| পরামিতি | |
|---|---|
key : string | The name of the attribute. |
value : string | Attribute value. |
| রিটার্নস | |
|---|---|
Slot | The slot object on which the method was called. |
setCategoryExclusion
setCategoryExclusion ( categoryExclusion : string ) : Slot- উদাহরণ
জাভাস্ক্রিপ্ট
// Label = AirlineAd googletag .defineSlot("/1234567/sports", [160, 600], "div") .setCategoryExclusion("AirlineAd") .addService(googletag.pubads());
JavaScript (legacy)
// Label = AirlineAd googletag .defineSlot("/1234567/sports", [160, 600], "div") .setCategoryExclusion("AirlineAd") .addService(googletag.pubads());
টাইপস্ক্রিপ্ট
// Label = AirlineAd googletag .defineSlot("/1234567/sports", [160, 600], "div")! .setCategoryExclusion("AirlineAd") .addService(googletag.pubads());
- আরো দেখুন
| পরামিতি | |
|---|---|
categoryExclusion : string | The ad category exclusion label to add. |
| রিটার্নস | |
|---|---|
Slot | The slot object on which the method was called. |
setClickUrl
setClickUrl ( value : string ) : SlotThe Google Ad Manager servers still record a click even if the click URL is replaced. Any landing page URL associated with the creative that is served is appended to the provided value. Subsequent calls overwrite the value. This works only for non-SRA requests.
- উদাহরণ
জাভাস্ক্রিপ্ট
googletag .defineSlot("/1234567/sports", [160, 600], "div") .setClickUrl("http://www.example.com?original_click_url=") .addService(googletag.pubads());
JavaScript (legacy)
googletag .defineSlot("/1234567/sports", [160, 600], "div") .setClickUrl("http://www.example.com?original_click_url=") .addService(googletag.pubads());
টাইপস্ক্রিপ্ট
googletag .defineSlot("/1234567/sports", [160, 600], "div")! .setClickUrl("http://www.example.com?original_click_url=") .addService(googletag.pubads());
| পরামিতি | |
|---|---|
value : string | The click URL to set. |
| রিটার্নস | |
|---|---|
Slot | The slot object on which the method was called. |
setCollapseEmptyDiv
setCollapseEmptyDiv ( collapse : boolean , collapseBeforeAdFetch ?: boolean ) : Slotdiv should be hidden when there is no ad in the slot. This overrides the service-level settings.- উদাহরণ
জাভাস্ক্রিপ্ট
googletag .defineSlot("/1234567/sports", [160, 600], "div-1") .setCollapseEmptyDiv(true, true) .addService(googletag.pubads()); // The above will cause the div for this slot to be collapsed // when the page is loaded, before ads are requested. googletag .defineSlot("/1234567/sports", [160, 600], "div-2") .setCollapseEmptyDiv(true) .addService(googletag.pubads()); // The above will cause the div for this slot to be collapsed // only after GPT detects that no ads are available for the slot.
JavaScript (legacy)
googletag .defineSlot("/1234567/sports", [160, 600], "div-1") .setCollapseEmptyDiv(true, true) .addService(googletag.pubads()); // The above will cause the div for this slot to be collapsed // when the page is loaded, before ads are requested. googletag .defineSlot("/1234567/sports", [160, 600], "div-2") .setCollapseEmptyDiv(true) .addService(googletag.pubads()); // The above will cause the div for this slot to be collapsed // only after GPT detects that no ads are available for the slot.
টাইপস্ক্রিপ্ট
googletag .defineSlot("/1234567/sports", [160, 600], "div-1")! .setCollapseEmptyDiv(true, true) .addService(googletag.pubads()); // The above will cause the div for this slot to be collapsed // when the page is loaded, before ads are requested. googletag .defineSlot("/1234567/sports", [160, 600], "div-2")! .setCollapseEmptyDiv(true) .addService(googletag.pubads()); // The above will cause the div for this slot to be collapsed // only after GPT detects that no ads are available for the slot.
- আরো দেখুন
| পরামিতি | |
|---|---|
collapse : boolean | Whether to collapse the slot if no ad is returned. |
| Whether to collapse the slot even before an ad is fetched. Ignored if collapse is not true . |
| রিটার্নস | |
|---|---|
Slot | The slot object on which the method was called. |
setConfig
setConfig ( slotConfig : SlotSettingsConfig ) : void| পরামিতি | |
|---|---|
slotConfig : SlotSettingsConfig | The configuration object. |
setForceSafeFrame
setForceSafeFrame ( forceSafeFrame : boolean ) : SlotPlease keep the following things in mind while using this API:
- This setting will only take effect for subsequent ad requests made for the respective slots.
- The slot level setting, if specified, will always override the page level setting.
- If set to
true(at slot-level or page level), the ad will always be rendered using a SafeFrame container independent of the choice made in the Google Ad Manager UI. - However, if set to
falseor left unspecified, the ad will be rendered using a SafeFrame container depending on the type of creative and the selection made in the Google Ad Manager UI. - This API should be used with caution as it could impact the behaviour of creatives that attempt to break out of their iFrames or rely on them being rendered directly in a publishers page.
- উদাহরণ
জাভাস্ক্রিপ্ট
googletag .defineSlot("/1234567/sports", [160, 600], "div") .setForceSafeFrame(true) .addService(googletag.pubads());
JavaScript (legacy)
googletag .defineSlot("/1234567/sports", [160, 600], "div") .setForceSafeFrame(true) .addService(googletag.pubads());
টাইপস্ক্রিপ্ট
googletag .defineSlot("/1234567/sports", [160, 600], "div")! .setForceSafeFrame(true) .addService(googletag.pubads());
- আরো দেখুন
| পরামিতি | |
|---|---|
forceSafeFrame : boolean | true to force all ads in this slot to be rendered in SafeFrames and false to opt-out of a page-level setting (if present). Setting this to false when not specified at the page-level won't change anything. |
| রিটার্নস | |
|---|---|
Slot | The slot object on which the method was called. |
setSafeFrameConfig
setSafeFrameConfig ( config : SafeFrameConfig ) : SlotThese slot-level preferences, if specified, will override any page-level preferences.
- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.pubads().setForceSafeFrame(true); // The following slot will have a sandboxed safeframe that only // disallows top-level navigation. googletag .defineSlot("/1234567/sports", [160, 600], "div-1") .setSafeFrameConfig({ sandbox: true }) .addService(googletag.pubads()); // The following slot will inherit page-level settings. googletag.defineSlot("/1234567/news", [160, 600], "div-2").addService(googletag.pubads()); googletag.display("div-1"); googletag.display("div-2");
JavaScript (legacy)
googletag.pubads().setForceSafeFrame(true); // The following slot will have a sandboxed safeframe that only // disallows top-level navigation. googletag .defineSlot("/1234567/sports", [160, 600], "div-1") .setSafeFrameConfig({ sandbox: true }) .addService(googletag.pubads()); // The following slot will inherit page-level settings. googletag.defineSlot("/1234567/news", [160, 600], "div-2").addService(googletag.pubads()); googletag.display("div-1"); googletag.display("div-2");
টাইপস্ক্রিপ্ট
googletag.pubads().setForceSafeFrame(true); // The following slot will have a sandboxed safeframe that only // disallows top-level navigation. googletag .defineSlot("/1234567/sports", [160, 600], "div-1")! .setSafeFrameConfig({ sandbox: true }) .addService(googletag.pubads()); // The following slot will inherit page-level settings. googletag.defineSlot("/1234567/news", [160, 600], "div-2")!.addService(googletag.pubads()); googletag.display("div-1"); googletag.display("div-2");
- আরো দেখুন
| পরামিতি | |
|---|---|
config : SafeFrameConfig | The configuration object. |
| রিটার্নস | |
|---|---|
Slot | The slot object on which the method was called. |
setTargeting
setTargeting ( key : string , value : string | string [] ) : Slot- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Example with a single value for a key. slot.setTargeting("allow_expandable", "true"); // Example with multiple values for a key inside in an array. slot.setTargeting("interests", ["sports", "music"]);
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Example with a single value for a key. slot.setTargeting("allow_expandable", "true"); // Example with multiple values for a key inside in an array. slot.setTargeting("interests", ["sports", "music"]);
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .addService(googletag.pubads()); // Example with a single value for a key. slot.setTargeting("allow_expandable", "true"); // Example with multiple values for a key inside in an array. slot.setTargeting("interests", ["sports", "music"]);
- আরো দেখুন
| পরামিতি | |
|---|---|
key : string | Targeting parameter key. |
value : string | string [] | Targeting parameter value or array of values. |
| রিটার্নস | |
|---|---|
Slot | The slot object on which the method was called. |
updateTargetingFromMap
updateTargetingFromMap ( map : {
[ adUnitPath : string ] : string | string [] ;
} ) : Slotনোট:
- In case of overwriting, only the last value will be kept.
- If the value is an array, any previous value will be overwritten, not merged.
- Values set here will overwrite targeting parameters set at the service-level.
- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag.defineSlot("/1234567/sports", [160, 600], "div"); slot.updateTargetingFromMap({ color: "red", interests: ["sports", "music", "movies"], });
JavaScript (legacy)
var slot = googletag.defineSlot("/1234567/sports", [160, 600], "div"); slot.updateTargetingFromMap({ color: "red", interests: ["sports", "music", "movies"], });
টাইপস্ক্রিপ্ট
const slot = googletag.defineSlot("/1234567/sports", [160, 600], "div")!; slot.updateTargetingFromMap({ color: "red", interests: ["sports", "music", "movies"], });
| পরামিতি | |
|---|---|
map : { | Targeting parameter key:value map. |
| রিটার্নস | |
|---|---|
Slot | The slot object on which the method was called. |
googletag.config
| ইন্টারফেস | |
|---|---|
Ad Expansion Config | Settings to control ad expansion. |
Ad Sense Attributes Config | Settings to control the behavior of AdSense ads. |
Component Auction Config | An object representing a single component auction in a on-device ad auction. |
Interstitial Config | An object which defines the behavior of a single interstitial ad slot. |
Lazy Load Config | Settings to control the use of lazy loading in GPT. |
Page Settings Config | Main configuration interface for page-level settings. |
Privacy Treatments Config | Settings to control publisher privacy treatments. |
Publisher Provided Signals Config | Publisher provided signals (PPS) configuration object. |
Safe Frame Config | Settings to control SafeFrame in GPT. |
Slot Settings Config | Main configuration interface for slot-level settings. |
Taxonomy Data | An object containing the values for a single Taxonomy . |
Video Ads Config | Settings to configure video ad related settings. |
| Type Aliases | |
|---|---|
Collapse Div Behavior | Supported values for controlling the collapsing behavior of ad slots. |
Interstitial Trigger | Supported interstitial ad triggers. |
Privacy Treatment | Supported publisher privacy treatments. |
Taxonomy | Supported taxonomies for publisher provided signals (PPS) . |
Type Aliases
CollapseDivBehavior
CollapseDivBehavior : "DISABLED" | "BEFORE_FETCH" | "ON_NO_FILL"InterstitialTrigger
InterstitialTrigger : "unhideWindow" | "navBar"PrivacyTreatment
PrivacyTreatment : "disablePersonalization"Taxonomy
Taxonomy : "IAB_AUDIENCE_1_1" | "IAB_CONTENT_2_2"googletag.config.AdExpansionConfig
| Properties | |
|---|---|
enabled ? | Whether ad expansion is enabled or disabled. |
- উদাহরণ
জাভাস্ক্রিপ্ট
// Enable ad slot expansion across the entire page. googletag.setConfig({ adExpansion: { enabled: true }, });
JavaScript (legacy)
// Enable ad slot expansion across the entire page. googletag.setConfig({ adExpansion: { enabled: true }, });
টাইপস্ক্রিপ্ট
// Enable ad slot expansion across the entire page. googletag.setConfig({ adExpansion: { enabled: true }, });
Properties
Optional enabled
enabled ?: booleanSetting this value overrides the default configured in Google Ad Manager.
googletag.config.AdSenseAttributesConfig
These attributes can be used to override server-side settings on a per-request basis.
| Properties | |
|---|---|
adsense _ad _format ? | AdSense ad format. |
adsense _channel _ids ? | AdSense channel IDs. |
adsense _test _mode ? | Whether or not test mode is enabled. |
document _language ? | Language of the page on which ads are displayed. |
page _url ? | URL of the page on which ads are displayed. |
Properties
Optional adsense_ad_format
adsense_ad_format ?: "120x240_as" | "120x600_as" | "125x125_as" | "160x600_as" | "180x150_as" | "200x200_as" | "234x60_as" | "250x250_as" | "300x250_as" | "336x280_as" | "468x60_as" | "728x90_as" Optional adsense_channel_ids
adsense_channel_ids ?: stringAllowed values are channel IDs separated by '+'.
Example:
271828183+314159265 Optional adsense_test_mode
adsense_test_mode ?: "on"When set to
on , ads are marked as test-only, and won't be included in counting or billing. This setting must be unset for production, non-test traffic. Optional document_language
document_language ?: stringAllowed values are valid ISO 639-1 language codes.
Example:
en- আরো দেখুন
Optional page_url
page_url ?: stringAllowed values are valid URLs.
Example:
http://www.example.com googletag.config.ComponentAuctionConfig
| Properties | |
|---|---|
auction Config | An auction configuration object for this component auction. |
config Key | The configuration key associated with this component auction. |
Properties
auctionConfig
auctionConfig : {
auctionSignals ?: unknown ;
decisionLogicURL : string ;
interestGroupBuyers ?: string [] ;
perBuyerExperimentGroupIds ?: {
[ buyer : string ] : number ;
} ;
perBuyerGroupLimits ?: {
[ buyer : string ] : number ;
} ;
perBuyerSignals ?: {
[ buyer : string ] : unknown ;
} ;
perBuyerTimeouts ?: {
[ buyer : string ] : number ;
} ;
seller : string ;
sellerExperimentGroupId ?: number ;
sellerSignals ?: unknown ;
sellerTimeout ?: number ;
trustedScoringSignalsURL ?: string ;
}If this value is set to
null , any existing configuration for the specified configKey will be deleted.- উদাহরণ
জাভাস্ক্রিপ্ট
const componentAuctionConfig = { // Seller URL should be https and the same as decisionLogicURL's origin seller: "https://testSeller.com", decisionLogicURL: "https://testSeller.com/ssp/decision-logic.js", interestGroupBuyers: ["https://example-buyer.com"], auctionSignals: { auction_signals: "auction_signals" }, sellerSignals: { seller_signals: "seller_signals" }, perBuyerSignals: { // listed on interestGroupBuyers "https://example-buyer.com": { per_buyer_signals: "per_buyer_signals", }, }, }; const auctionSlot = googletag.defineSlot("/1234567/example", [160, 600]); // To add configKey to the component auction: auctionSlot.setConfig({ componentAuction: [ { configKey: "https://testSeller.com", auctionConfig: componentAuctionConfig, }, ], }); // To remove configKey from the component auction: auctionSlot.setConfig({ componentAuction: [ { configKey: "https://testSeller.com", auctionConfig: null, }, ], });
JavaScript (legacy)
var componentAuctionConfig = { // Seller URL should be https and the same as decisionLogicURL's origin seller: "https://testSeller.com", decisionLogicURL: "https://testSeller.com/ssp/decision-logic.js", interestGroupBuyers: ["https://example-buyer.com"], auctionSignals: { auction_signals: "auction_signals" }, sellerSignals: { seller_signals: "seller_signals" }, perBuyerSignals: { // listed on interestGroupBuyers "https://example-buyer.com": { per_buyer_signals: "per_buyer_signals", }, }, }; var auctionSlot = googletag.defineSlot("/1234567/example", [160, 600]); // To add configKey to the component auction: auctionSlot.setConfig({ componentAuction: [ { configKey: "https://testSeller.com", auctionConfig: componentAuctionConfig, }, ], }); // To remove configKey from the component auction: auctionSlot.setConfig({ componentAuction: [ { configKey: "https://testSeller.com", auctionConfig: null, }, ], });
টাইপস্ক্রিপ্ট
const componentAuctionConfig = { // Seller URL should be https and the same as decisionLogicURL's origin seller: "https://testSeller.com", decisionLogicURL: "https://testSeller.com/ssp/decision-logic.js", interestGroupBuyers: ["https://example-buyer.com"], auctionSignals: { auction_signals: "auction_signals" }, sellerSignals: { seller_signals: "seller_signals" }, perBuyerSignals: { // listed on interestGroupBuyers "https://example-buyer.com": { per_buyer_signals: "per_buyer_signals", }, }, }; const auctionSlot = googletag.defineSlot("/1234567/example", [160, 600])!; // To add configKey to the component auction: auctionSlot.setConfig({ componentAuction: [ { configKey: "https://testSeller.com", auctionConfig: componentAuctionConfig, }, ], }); // To remove configKey from the component auction: auctionSlot.setConfig({ componentAuction: [ { configKey: "https://testSeller.com", auctionConfig: null, }, ], });
configKey
configKey : stringThis value must be non-empty and should be unique. If two
ComponentAuctionConfig objects share the same configKey value, the last to be set will overwrite prior configurations. googletag.config.InterstitialConfig
| Properties | |
|---|---|
require Storage Access ? | Whether local storage consent is required to display this interstitial ad. |
triggers ? | The interstitial trigger configuration for this interstitial ad. |
Properties
Optional requireStorageAccess
requireStorageAccess ?: booleanGPT uses local storage to enforce a frequency cap for interstitial ads. However, users who have not provided local storage consent are still eligible to be served interstitial ads. Setting this property to
true opts out of the default behavior, and ensures interstial ads are only shown to users who have provided local storage consent.- উদাহরণ
জাভাস্ক্রিপ্ট
// Opt out of showing interstitials to users // without local storage consent. const interstitialSlot = googletag.defineOutOfPageSlot( "/1234567/sports", googletag.enums.OutOfPageFormat.INTERSTITIAL, ); interstitialSlot.setConfig({ interstitial: { requireStorageAccess: true, // defaults to false }, });
JavaScript (legacy)
// Opt out of showing interstitials to users // without local storage consent. var interstitialSlot = googletag.defineOutOfPageSlot( "/1234567/sports", googletag.enums.OutOfPageFormat.INTERSTITIAL, ); interstitialSlot.setConfig({ interstitial: { requireStorageAccess: true, // defaults to false }, });
টাইপস্ক্রিপ্ট
// Opt out of showing interstitials to users // without local storage consent. const interstitialSlot = googletag.defineOutOfPageSlot( "/1234567/sports", googletag.enums.OutOfPageFormat.INTERSTITIAL, )!; interstitialSlot.setConfig({ interstitial: { requireStorageAccess: true, // defaults to false }, });
- আরো দেখুন
Optional triggers
triggers ?: Partial < Record < InterstitialTrigger , boolean > >Setting the value of an interstitial trigger to
true will enable it and false will disable it. This will override the default values configured in Google Ad Manager .- উদাহরণ
জাভাস্ক্রিপ্ট
// Define a GPT managed web interstitial ad slot. const interstitialSlot = googletag.defineOutOfPageSlot( "/1234567/sports", googletag.enums.OutOfPageFormat.INTERSTITIAL, ); // Enable optional interstitial triggers. // Change this value to false to disable. const enableTriggers = true; interstitialSlot.setConfig({ interstitial: { triggers: { navBar: enableTriggers, unhideWindow: enableTriggers, }, }, });
JavaScript (legacy)
// Define a GPT managed web interstitial ad slot. var interstitialSlot = googletag.defineOutOfPageSlot( "/1234567/sports", googletag.enums.OutOfPageFormat.INTERSTITIAL, ); // Enable optional interstitial triggers. // Change this value to false to disable. var enableTriggers = true; interstitialSlot.setConfig({ interstitial: { triggers: { navBar: enableTriggers, unhideWindow: enableTriggers, }, }, });
টাইপস্ক্রিপ্ট
// Define a GPT managed web interstitial ad slot. const interstitialSlot = googletag.defineOutOfPageSlot( "/1234567/sports", googletag.enums.OutOfPageFormat.INTERSTITIAL, )!; // Enable optional interstitial triggers. // Change this value to false to disable. const enableTriggers = true; interstitialSlot.setConfig({ interstitial: { triggers: { navBar: enableTriggers, unhideWindow: enableTriggers, }, }, });
- আরো দেখুন
googletag.config.LazyLoadConfig
| Properties | |
|---|---|
fetch Margin Percent ? | The minimum distance from the current viewport a slot must be before we request an ad, expressed as a percentage of viewport size. |
mobile Scaling ? | A multiplier applied to margins on mobile devices. |
render Margin Percent ? | The minimum distance from the current viewport a slot must be before we render an ad, expressed as a percentage of viewport size. |
- আরো দেখুন
Properties
Optional fetchMarginPercent
fetchMarginPercent ?: numberUsed in conjunction with renderMarginPercent , this setting allows for prefetching an ad, but waiting to render and download other subresources. As such, this value should always be greater than or equal to renderMarginPercent .
A value of
0 means "when the slot enters the viewport", 100 means "when the ad is 1 viewport away", and so on. Optional mobileScaling
mobileScaling ?: numberThis allows for different margins on mobile vs. desktop, where viewport sizes and scroll speeds may be different. For example, a value of 2.0 will multiply all margins by 2 on mobile devices, increasing the minimum distance a slot can be from the viewport before fetching and rendering.
Optional renderMarginPercent
renderMarginPercent ?: numberUsed in conjunction with fetchMarginPercent , this setting allows for prefetching an ad, but waiting to render and download other subresources. As such, this value should always be less than or equal to fetchMarginPercent .
A value of
0 means "when the slot enters the viewport", 100 means "when the ad is 1 viewport away", and so on. googletag.config.PageSettingsConfig
Allows setting multiple features with a single API call.
All properties listed below are examples and do not reflect actual features that utilize setConfig. For the set of features, see fields within the PageSettingsConfig type below.
উদাহরণ:
- Only features specified in the googletag.setConfig call are modified.
// Configure feature alpha. googletag.setConfig({ alpha: {...} }); // Configure feature bravo. Feature alpha is unchanged. googletag.setConfig({ bravo: {...} });
- All settings for a given feature are updated with each call to googletag.setConfig .
// Configure feature charlie to echo = 1, foxtrot = true. googletag.setConfig({ charlie: { echo: 1, foxtrot: true, } }); // Update feature charlie to echo = 2. Since foxtrot was not specified, // the value is cleared. googletag.setConfig({ charlie: { echo: 2 } });
- All settings for a feature can be cleared by passing
null.// Configure features delta, golf, and hotel. googletag.setConfig({ delta: {...}, golf: {...}, hotel: {...}, }); // Feature delta and hotel are cleared, but feature golf remains set. googletag.setConfig({ delta: null, hotel: null, });
| Properties | |
|---|---|
ad Expansion ? | Settings to control ad expansion. |
adsense Attributes ? | Setting to configure AdSense attributes. |
ad Yield ? | Deprecated. |
category Exclusion ? | Setting to configure ad category exclusions. |
centering ? | Setting to control the horizontal centering of ads. |
collapse Div ? | Setting to control the collapsing behavior of ad slots. |
disable Initial Load ? | Setting to control when ads are requested. |
lazy Load ? | Settings to control the use of lazy loading in GPT. |
location ? | Setting to geo-target line items to geographic locations. |
pps ? | Settings to control publisher provided signals (PPS). |
privacy Treatments ? | Settings to control publisher privacy treatments. |
safe Frame ? | Settings to control the use of SafeFrame in GPT. |
single Request ? | Setting to enable or disable Single Request Architecture (SRA). |
targeting ? | Setting to control key-value targeting. |
thread Yield ? | Setting to control whether GPT should yield the JS thread when requesting and rendering creatives. |
video Ads ? | Settings to control video ads. |
Properties
Optional adExpansion
adExpansion ?: AdExpansionConfig Optional adsenseAttributes
adsenseAttributes ?: AdSenseAttributesConfigAdSense attributes configured via this setting will apply to all ad slots on the page. This setting may be called multiple times to define multiple attribute values, or overwrite existing values.
AdSense attribute changes only apply to ads requested after this method has been called. For that reason, it is recommended to call this method before any calls to googletag.display or PubAdsService.refresh .
- উদাহরণ
জাভাস্ক্রিপ্ট
// Set the document language and page URL. googletag.setConfig({ adsenseAttributes: { document_language: "en", page_url: "http://www.example.com" }, }); // Clear the page URL only. googletag.setConfig({ adsenseAttributes: { page_url: null } }); // Clear all AdSense attributes. googletag.setConfig({ adsenseAttributes: null });
JavaScript (legacy)
// Set the document language and page URL. googletag.setConfig({ adsenseAttributes: { document_language: "en", page_url: "http://www.example.com" }, }); // Clear the page URL only. googletag.setConfig({ adsenseAttributes: { page_url: null } }); // Clear all AdSense attributes. googletag.setConfig({ adsenseAttributes: null });
টাইপস্ক্রিপ্ট
// Set the document language and page URL. googletag.setConfig({ adsenseAttributes: { document_language: "en", page_url: "http://www.example.com" }, }); // Clear the page URL only. googletag.setConfig({ adsenseAttributes: { page_url: null } }); // Clear all AdSense attributes. googletag.setConfig({ adsenseAttributes: null });
Optional adYield
adYield ?: "DISABLED" | "ENABLED_ALL_SLOTS" Optional categoryExclusion
categoryExclusion ?: string []- উদাহরণ
জাভাস্ক্রিপ্ট
// Label = AirlineAd. googletag.setConfig({ categoryExclusion: ["AirlineAd"] }); // Clearing category exclusion setting. googletag.setConfig({ categoryExclusion: null });
JavaScript (legacy)
// Label = AirlineAd. googletag.setConfig({ categoryExclusion: ["AirlineAd"] }); // Clearing category exclusion setting. googletag.setConfig({ categoryExclusion: null });
টাইপস্ক্রিপ্ট
// Label = AirlineAd. googletag.setConfig({ categoryExclusion: ["AirlineAd"] }); // Clearing category exclusion setting. googletag.setConfig({ categoryExclusion: null });
- আরো দেখুন
Optional centering
centering ?: booleanHorizontal centering changes only apply to ads requested after this method has been called. For that reason, it is recommended to call this method before any calls to googletag.display or PubAdsService.refresh .
- উদাহরণ
জাভাস্ক্রিপ্ট
// Make ads centered. googletag.setConfig({ centering: true }); // Clear the centering setting. googletag.setConfig({ centering: null });
JavaScript (legacy)
// Make ads centered. googletag.setConfig({ centering: true }); // Clear the centering setting. googletag.setConfig({ centering: null });
টাইপস্ক্রিপ্ট
// Make ads centered. googletag.setConfig({ centering: true }); // Clear the centering setting. googletag.setConfig({ centering: null });
Optional collapseDiv
collapseDiv ?: CollapseDivBehaviorA collapsed ad slot does not take up any space on the page.
Supported values:
-
null(default): The slot will not be collapsed. -
DISABLED: The slot will not collapse, whether or not an ad is returned. -
BEFORE_FETCH: The slot will start out collapsed, and expand when an ad is returned. -
ON_NO_FILL: The slot will start out expanded, and collapse if no ad is returned.
- উদাহরণ
জাভাস্ক্রিপ্ট
// Collapse the div for this slot if no ad is returned. googletag.setConfig({ collapseDiv: "ON_NO_FILL" }); // Collapse the div for this slot by default, and expand only // if an ad is returned. googletag.setConfig({ collapseDiv: "BEFORE_FETCH" }); // Do not collapse the div for this slot. googletag.setConfig({ collapseDiv: "DISABLED" }); // Clear the collapse setting. googletag.setConfig({ collapseDiv: null });
JavaScript (legacy)
// Collapse the div for this slot if no ad is returned. googletag.setConfig({ collapseDiv: "ON_NO_FILL" }); // Collapse the div for this slot by default, and expand only // if an ad is returned. googletag.setConfig({ collapseDiv: "BEFORE_FETCH" }); // Do not collapse the div for this slot. googletag.setConfig({ collapseDiv: "DISABLED" }); // Clear the collapse setting. googletag.setConfig({ collapseDiv: null });
টাইপস্ক্রিপ্ট
// Collapse the div for this slot if no ad is returned. googletag.setConfig({ collapseDiv: "ON_NO_FILL" }); // Collapse the div for this slot by default, and expand only // if an ad is returned. googletag.setConfig({ collapseDiv: "BEFORE_FETCH" }); // Do not collapse the div for this slot. googletag.setConfig({ collapseDiv: "DISABLED" }); // Clear the collapse setting. googletag.setConfig({ collapseDiv: null });
- আরো দেখুন
Optional disableInitialLoad
disableInitialLoad ?: booleanBy default, the googletag.display method both registers ad slots and requests ads for them. However, there are times when it may be preferable to separate these actions, in order to more precisely control when ad content is loaded.
By enabling this setting, ads will not be requested for registered slots when the
display() method is called. Instead, a separate call to PubAdsService.refresh must be made to initiate an ad request.This method must be called before calling googletag.enableServices .
- উদাহরণ
জাভাস্ক্রিপ্ট
// Prevent requesting ads when `display()` is called. googletag.setConfig({ disableInitialLoad: true });
JavaScript (legacy)
// Prevent requesting ads when `display()` is called. googletag.setConfig({ disableInitialLoad: true });
টাইপস্ক্রিপ্ট
// Prevent requesting ads when `display()` is called. googletag.setConfig({ disableInitialLoad: true });
Optional lazyLoad
lazyLoad ?: LazyLoadConfigLazy loading is a technique to delay the requesting and rendering of ads until they approach the user's viewport. For a more detailed example, see the Lazy loading sample.
Note: If
singleRequest is enabled, lazy fetching only works when all slots are outside the fetch margin.Any lazy load settings which are not specified when calling
setConfig() will use a default value set by Google. These defaults may be tuned over time. To disable a particular setting, set the value to null .- উদাহরণ
জাভাস্ক্রিপ্ট
// Enable lazy loading. googletag.setConfig({ lazyLoad: { // Fetch slots within 5 viewports. fetchMarginPercent: 500, // Render slots within 2 viewports. renderMarginPercent: 200, // Double the above values on mobile. mobileScaling: 2.0, }, }); // Clear fetch margin only. googletag.setConfig({ lazyLoad: { fetchMarginPercent: null }, }); // Clear all lazy loading settings. googletag.setConfig({ lazyLoad: null });
JavaScript (legacy)
// Enable lazy loading. googletag.setConfig({ lazyLoad: { // Fetch slots within 5 viewports. fetchMarginPercent: 500, // Render slots within 2 viewports. renderMarginPercent: 200, // Double the above values on mobile. mobileScaling: 2.0, }, }); // Clear fetch margin only. googletag.setConfig({ lazyLoad: { fetchMarginPercent: null }, }); // Clear all lazy loading settings. googletag.setConfig({ lazyLoad: null });
টাইপস্ক্রিপ্ট
// Enable lazy loading. googletag.setConfig({ lazyLoad: { // Fetch slots within 5 viewports. fetchMarginPercent: 500, // Render slots within 2 viewports. renderMarginPercent: 200, // Double the above values on mobile. mobileScaling: 2.0, }, }); // Clear fetch margin only. googletag.setConfig({ lazyLoad: { fetchMarginPercent: null }, }); // Clear all lazy loading settings. googletag.setConfig({ lazyLoad: null });
Optional location
location ?: string- উদাহরণ
জাভাস্ক্রিপ্ট
// Geo-target line items to US postal code 10001. googletag.setConfig({ location: "10001,US" }); // Clear the location setting. googletag.setConfig({ location: null });
JavaScript (legacy)
// Geo-target line items to US postal code 10001. googletag.setConfig({ location: "10001,US" }); // Clear the location setting. googletag.setConfig({ location: null });
টাইপস্ক্রিপ্ট
// Geo-target line items to US postal code 10001. googletag.setConfig({ location: "10001,US" }); // Clear the location setting. googletag.setConfig({ location: null });
- আরো দেখুন
Optional pps
Optional privacyTreatments
privacyTreatments ?: PrivacyTreatmentsConfig Optional safeFrame
safeFrame ?: SafeFrameConfigValues configured via this setting will apply to all ad slots on the page. Individual ad slots may override these values via SlotSettingsConfig.safeFrame .
- উদাহরণ
জাভাস্ক্রিপ্ট
// Force SafeFrame for all ads on the page. googletag.setConfig({ safeFrame: { forceSafeFrame: true }, }); // Configure SafeFrame to allow overlay expansion. googletag.setConfig({ safeFrame: { allowOverlayExpansion: true }, }); // Clear forceSafeFrame setting. googletag.setConfig({ safeFrame: { forceSafeFrame: null }, }); // Clear all SafeFrame settings. googletag.setConfig({ safeFrame: null });
JavaScript (legacy)
// Force SafeFrame for all ads on the page. googletag.setConfig({ safeFrame: { forceSafeFrame: true }, }); // Configure SafeFrame to allow overlay expansion. googletag.setConfig({ safeFrame: { allowOverlayExpansion: true }, }); // Clear forceSafeFrame setting. googletag.setConfig({ safeFrame: { forceSafeFrame: null }, }); // Clear all SafeFrame settings. googletag.setConfig({ safeFrame: null });
টাইপস্ক্রিপ্ট
// Force SafeFrame for all ads on the page. googletag.setConfig({ safeFrame: { forceSafeFrame: true }, }); // Configure SafeFrame to allow overlay expansion. googletag.setConfig({ safeFrame: { allowOverlayExpansion: true }, }); // Clear forceSafeFrame setting. googletag.setConfig({ safeFrame: { forceSafeFrame: null }, }); // Clear all SafeFrame settings. googletag.setConfig({ safeFrame: null });
Optional singleRequest
singleRequest ?: booleanWhen SRA is enabled, all ad slots defined prior to a googletag.display or PubAdsService.refresh call will be batched into a single ad request. This provides performance benefits, but is also necessary to ensure roadblocks and competetive exclusions are honored.
When SRA is disabled, each ad slot is requested individually. This is the default behavior of GPT.
This method must be called prior to calling googletag.enableServices .
- উদাহরণ
জাভাস্ক্রিপ্ট
// Enable Single Request Architecture. googletag.setConfig({ singleRequest: true });
JavaScript (legacy)
// Enable Single Request Architecture. googletag.setConfig({ singleRequest: true });
টাইপস্ক্রিপ্ট
// Enable Single Request Architecture. googletag.setConfig({ singleRequest: true });
Optional targeting
targeting ?: Record < string , string | string [] >Targeting configured via this setting will apply to all ad slots on the page. This setting may be called multiple times to define multiple targeting key-values, or overwrite existing values. Targeting keys are defined in your Google Ad Manager account.
- উদাহরণ
জাভাস্ক্রিপ্ট
// Setting a single targeting key-value. googletag.setConfig({ targeting: { interests: "sports" } }); // Setting multiple values for a single targeting key googletag.setConfig({ targeting: { interests: ["sports", "music"] } }); // Setting multiple targeting key-values at once. googletag.setConfig({ targeting: { interests: ["sports", "music"], color: "red" } }); // Clearing a single targeting key. googletag.setConfig({ targeting: { interests: null } });
JavaScript (legacy)
// Setting a single targeting key-value. googletag.setConfig({ targeting: { interests: "sports" } }); // Setting multiple values for a single targeting key googletag.setConfig({ targeting: { interests: ["sports", "music"] } }); // Setting multiple targeting key-values at once. googletag.setConfig({ targeting: { interests: ["sports", "music"], color: "red" } }); // Clearing a single targeting key. googletag.setConfig({ targeting: { interests: null } });
টাইপস্ক্রিপ্ট
// Setting a single targeting key-value. googletag.setConfig({ targeting: { interests: "sports" } }); // Setting multiple values for a single targeting key googletag.setConfig({ targeting: { interests: ["sports", "music"] } }); // Setting multiple targeting key-values at once. googletag.setConfig({ targeting: { interests: ["sports", "music"], color: "red" } }); // Clearing a single targeting key. googletag.setConfig({ targeting: { interests: null } });
- আরো দেখুন
Optional threadYield
threadYield ?: "DISABLED" | "ENABLED_ALL_SLOTS"GPT will yield only for browsers that support the Scheduler.postTask or Scheduler.yield API.
Supported values:
-
null(default): GPT will yield the JS thread for slots outside of the viewport. -
ENABLED_ALL_SLOTS: GPT will yield the JS thread for all slots regardless of whether the slot is within the viewport. -
DISABLED: GPT will not yield the JS thread.
- উদাহরণ
জাভাস্ক্রিপ্ট
// Disable yielding. googletag.setConfig({ threadYield: "DISABLED" }); // Enable yielding for all slots. googletag.setConfig({ threadYield: "ENABLED_ALL_SLOTS" }); // Enable yielding only for slots outside of the viewport (default). googletag.setConfig({ threadYield: null });
JavaScript (legacy)
// Disable yielding. googletag.setConfig({ threadYield: "DISABLED" }); // Enable yielding for all slots. googletag.setConfig({ threadYield: "ENABLED_ALL_SLOTS" }); // Enable yielding only for slots outside of the viewport (default). googletag.setConfig({ threadYield: null });
টাইপস্ক্রিপ্ট
// Disable yielding. googletag.setConfig({ threadYield: "DISABLED" }); // Enable yielding for all slots. googletag.setConfig({ threadYield: "ENABLED_ALL_SLOTS" }); // Enable yielding only for slots outside of the viewport (default). googletag.setConfig({ threadYield: null });
- আরো দেখুন
Optional videoAds
videoAds ?: VideoAdsConfig- উদাহরণ
জাভাস্ক্রিপ্ট
// Enable video ads and set video content and content source IDs. googletag.setConfig({ videoAds: { enableVideoAds: true, videoContentId: "e1eGlRL7ju8", videoCmsId: "1234567", }, });
JavaScript (legacy)
// Enable video ads and set video content and content source IDs. googletag.setConfig({ videoAds: { enableVideoAds: true, videoContentId: "e1eGlRL7ju8", videoCmsId: "1234567", }, });
টাইপস্ক্রিপ্ট
// Enable video ads and set video content and content source IDs. googletag.setConfig({ videoAds: { enableVideoAds: true, videoContentId: "e1eGlRL7ju8", videoCmsId: "1234567", }, });
- আরো দেখুন
googletag.config.PrivacyTreatmentsConfig
| Properties | |
|---|---|
treatments | An array of publisher privacy treatments to enable. |
Properties
চিকিৎসা
treatments : "disablePersonalization" []- উদাহরণ
জাভাস্ক্রিপ্ট
// Disable personalization across the entire page. googletag.setConfig({ privacyTreatments: { treatments: ["disablePersonalization"] }, });
JavaScript (legacy)
// Disable personalization across the entire page. googletag.setConfig({ privacyTreatments: { treatments: ["disablePersonalization"] }, });
টাইপস্ক্রিপ্ট
// Disable personalization across the entire page. googletag.setConfig({ privacyTreatments: { treatments: ["disablePersonalization"] }, });
googletag.config.PublisherProvidedSignalsConfig
| Properties | |
|---|---|
taxonomies | An object containing Taxonomy mappings or null to clear the config. |
- উদাহরণ
জাভাস্ক্রিপ্ট
googletag.setConfig({ pps: { taxonomies: { IAB_AUDIENCE_1_1: { values: ["6", "626"] }, // '6' = 'Demographic | Age Range | 30-34' // '626' = 'Interest | Sports | Darts' IAB_CONTENT_2_2: { values: ["48", "127"] }, // '48' = 'Books and Literature | Fiction' // '127' = 'Careers | Job Search' }, }, });
JavaScript (legacy)
googletag.setConfig({ pps: { taxonomies: { IAB_AUDIENCE_1_1: { values: ["6", "626"] }, // '6' = 'Demographic | Age Range | 30-34' // '626' = 'Interest | Sports | Darts' IAB_CONTENT_2_2: { values: ["48", "127"] }, // '48' = 'Books and Literature | Fiction' // '127' = 'Careers | Job Search' }, }, });
টাইপস্ক্রিপ্ট
googletag.setConfig({ pps: { taxonomies: { IAB_AUDIENCE_1_1: { values: ["6", "626"] }, // '6' = 'Demographic | Age Range | 30-34' // '626' = 'Interest | Sports | Darts' IAB_CONTENT_2_2: { values: ["48", "127"] }, // '48' = 'Books and Literature | Fiction' // '127' = 'Careers | Job Search' }, }, });
Properties
taxonomies
taxonomies : Partial < Record < Taxonomy , TaxonomyData > >googletag.config.SafeFrameConfig
| Properties | |
|---|---|
allow Overlay Expansion ? | Whether SafeFrame should allow ad content to expand by overlaying page content. |
allow Push Expansion ? | Whether SafeFrame should allow ad content to expand by pushing page content. |
force Safe Frame ? | Whether ad(s) should be forced to be rendered using a SafeFrame container. |
sandbox ? | Whether SafeFrame should use the HTML5 sandbox attribute to prevent top level navigation without user interaction. |
use Unique Domain ? | Deprecated. Whether SafeFrame should use randomized subdomains for Reservation creatives. |
Properties
Optional allowOverlayExpansion
allowOverlayExpansion ?: boolean Optional allowPushExpansion
allowPushExpansion ?: boolean Optional forceSafeFrame
forceSafeFrame ?: boolean Optional sandbox
sandbox ?: booleantrue (cannot be forced to false ). Note that the sandbox attribute disables plugins (eg Flash). Optional useUniqueDomain
useUniqueDomain ?: booleannull to clear the stored value.Note: this feature is enabled by default.
- আরো দেখুন
googletag.config.SlotSettingsConfig
Allows setting multiple features with a single API call for a single slot.
All properties listed below are examples and do not reflect actual features that utilize setConfig. For the set of features, see fields within the SlotSettingsConfig type below.
উদাহরণ:
- Only features specified in the Slot.setConfig call are modified.
const slot = googletag.defineSlot("/1234567/example", [160, 600]); // Configure feature alpha. slot.setConfig({ alpha: {...} }); // Configure feature bravo. Feature alpha is unchanged. slot.setConfig({ bravo: {...} });
- All settings for a given feature are updated with each call to Slot.setConfig .
// Configure feature charlie to echo = 1, foxtrot = true. slot.setConfig({ charlie: { echo: 1, foxtrot: true, } }); // Update feature charlie to echo = 2. Since foxtrot was not specified, // the value is cleared. slot.setConfig({ charlie: { echo: 2 } });
- All settings for a feature can be cleared by passing
null.// Configure features delta, golf, and hotel. slot.setConfig({ delta: {...}, golf: {...}, hotel: {...}, }); // Feature delta and hotel are cleared, but feature golf remains set. slot.setConfig({ delta: null, hotel: null, });
| Properties | |
|---|---|
ad Expansion ? | Settings to configure ad expansion. |
adsense Attributes ? | Setting to configure AdSense attributes. |
category Exclusion ? | Setting to configure ad category exclusions. |
click Url ? | Setting to configure the URL to which users will be redirected after clicking on the ad. |
collapse Div ? | Setting to configure the collapsing behavior of the ad slot. |
component Auction ? | An array of component auctions to be included in an on-device ad auction. |
interstitial ? | Settings that configure interstitial ad slot behavior. |
safe Frame ? | Settings to configure the use of SafeFrame in GPT. |
targeting ? | Setting to configure key-value targeting. |
Properties
Optional adExpansion
adExpansion ?: AdExpansionConfig- আরো দেখুন
Optional adsenseAttributes
adsenseAttributes ?: AdSenseAttributesConfigAdSense attributes configured via this setting will only apply to the ad slot. This setting may be called multiple times to define multiple attribute values, or overwrite existing values.
AdSense attribute changes only apply to ads requested after this method has been called. For that reason, it is recommended to call this method before any calls to googletag.display or PubAdsService.refresh .
- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Set the AdSense ad format and channel IDs. slot.setConfig({ adsenseAttributes: { adsense_ad_format: "120x240_as", adsense_channel_ids: "271828183+314159265", }, }); // Clear the AdSense channel IDs only. slot.setConfig({ adsenseAttributes: { adsense_channel_ids: null } }); // Clear all AdSense attributes. slot.setConfig({ adsenseAttributes: null });
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Set the AdSense ad format and channel IDs. slot.setConfig({ adsenseAttributes: { adsense_ad_format: "120x240_as", adsense_channel_ids: "271828183+314159265", }, }); // Clear the AdSense channel IDs only. slot.setConfig({ adsenseAttributes: { adsense_channel_ids: null } }); // Clear all AdSense attributes. slot.setConfig({ adsenseAttributes: null });
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .addService(googletag.pubads()); // Set the AdSense ad format and channel IDs. slot.setConfig({ adsenseAttributes: { adsense_ad_format: "120x240_as", adsense_channel_ids: "271828183+314159265", }, }); // Clear the AdSense channel IDs only. slot.setConfig({ adsenseAttributes: { adsense_channel_ids: null } }); // Clear all AdSense attributes. slot.setConfig({ adsenseAttributes: null });
Optional categoryExclusion
categoryExclusion ?: string []- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Label = AirlineAd slot.setConfig({ categoryExclusion: ["AirlineAd"], }); // Clearing category exclusion setting. slot.setConfig({ categoryExclusion: null });
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Label = AirlineAd slot.setConfig({ categoryExclusion: ["AirlineAd"], }); // Clearing category exclusion setting. slot.setConfig({ categoryExclusion: null });
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .addService(googletag.pubads()); // Label = AirlineAd slot.setConfig({ categoryExclusion: ["AirlineAd"], }); // Clearing category exclusion setting. slot.setConfig({ categoryExclusion: null });
- আরো দেখুন
Optional clickUrl
clickUrl ?: stringThe Google Ad Manager servers still record a click even if the click URL is replaced. Any landing page URL associated with the creative that is served is appended to the provided value. Setting this value more than once will overwrite any previously configured value. Passing in
null will clear the value.Note: This setting only applies to non-SRA requests .
- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Sets the click URL to 'http://www.example.com?original_click_url='. slot.setConfig({ clickUrl: "http://www.example.com?original_click_url=", }); // Clears the click URL. slot.setConfig({ clickUrl: null, });
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Sets the click URL to 'http://www.example.com?original_click_url='. slot.setConfig({ clickUrl: "http://www.example.com?original_click_url=", }); // Clears the click URL. slot.setConfig({ clickUrl: null, });
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .addService(googletag.pubads()); // Sets the click URL to 'http://www.example.com?original_click_url='. slot.setConfig({ clickUrl: "http://www.example.com?original_click_url=", }); // Clears the click URL. slot.setConfig({ clickUrl: null, });
Optional collapseDiv
collapseDiv ?: CollapseDivBehaviorA collapsed ad slot does not take up any space on the page.
Supported values:
-
null(default): The slot will not be collapsed. -
DISABLED: The slot will not collapse, whether or not an ad is returned. -
BEFORE_FETCH: The slot will start out collapsed, and expand when an ad is returned. -
ON_NO_FILL: The slot will start out expanded, and collapse if no ad is returned.
- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Collapse the div for this slot if no ad is returned. slot.setConfig({ collapseDiv: "ON_NO_FILL", }); // Collapse the div for this slot by default, and expand only // if an ad is returned. slot.setConfig({ collapseDiv: "BEFORE_FETCH", }); // Do not collapse the div for this slot. slot.setConfig({ collapseDiv: "DISABLED", }); // Clear the collapse setting. slot.setConfig({ collapseDiv: null, });
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Collapse the div for this slot if no ad is returned. slot.setConfig({ collapseDiv: "ON_NO_FILL", }); // Collapse the div for this slot by default, and expand only // if an ad is returned. slot.setConfig({ collapseDiv: "BEFORE_FETCH", }); // Do not collapse the div for this slot. slot.setConfig({ collapseDiv: "DISABLED", }); // Clear the collapse setting. slot.setConfig({ collapseDiv: null, });
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .addService(googletag.pubads()); // Collapse the div for this slot if no ad is returned. slot.setConfig({ collapseDiv: "ON_NO_FILL", }); // Collapse the div for this slot by default, and expand only // if an ad is returned. slot.setConfig({ collapseDiv: "BEFORE_FETCH", }); // Do not collapse the div for this slot. slot.setConfig({ collapseDiv: "DISABLED", }); // Clear the collapse setting. slot.setConfig({ collapseDiv: null, });
- আরো দেখুন
Optional componentAuction
componentAuction ?: ComponentAuctionConfig [] Optional interstitial
interstitial ?: InterstitialConfig- আরো দেখুন
Optional safeFrame
safeFrame ?: SafeFrameConfigValues configured via this setting will only apply to the ad slot, and override values set via PageSettingsConfig.safeFrame .
- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Force SafeFrame for the slot. slot.setConfig({ safeFrame: { forceSafeFrame: true }, }); // Configure SafeFrame to allow overlay expansion for the slot. slot.setConfig({ safeFrame: { allowOverlayExpansion: true }, }); // Clear forceSafeFrame setting for the slot. slot.setConfig({ safeFrame: { forceSafeFrame: null }, }); // Clear all SafeFrame settings for the slot. slot.setConfig({ safeFrame: null });
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Force SafeFrame for the slot. slot.setConfig({ safeFrame: { forceSafeFrame: true }, }); // Configure SafeFrame to allow overlay expansion for the slot. slot.setConfig({ safeFrame: { allowOverlayExpansion: true }, }); // Clear forceSafeFrame setting for the slot. slot.setConfig({ safeFrame: { forceSafeFrame: null }, }); // Clear all SafeFrame settings for the slot. slot.setConfig({ safeFrame: null });
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .addService(googletag.pubads()); // Force SafeFrame for the slot. slot.setConfig({ safeFrame: { forceSafeFrame: true }, }); // Configure SafeFrame to allow overlay expansion for the slot. slot.setConfig({ safeFrame: { allowOverlayExpansion: true }, }); // Clear forceSafeFrame setting for the slot. slot.setConfig({ safeFrame: { forceSafeFrame: null }, }); // Clear all SafeFrame settings for the slot. slot.setConfig({ safeFrame: null });
Optional targeting
targeting ?: Record < string , string | string [] >Targeting configured via this setting will only apply to the ad slot. This setting may be called multiple times to define multiple targeting key-values, or overwrite existing values. Targeting keys are defined in your Google Ad Manager account.
- উদাহরণ
জাভাস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Setting a single targeting key-value. slot.setConfig({ targeting: { interests: "sports" } }); // Setting multiple values for a single targeting key. slot.setConfig({ targeting: { interests: ["sports", "music"] } }); // Setting multiple targeting key-values at once. slot.setConfig({ targeting: { interests: ["sports", "music"], color: "red" } }); // Clearing a single targeting key. slot.setConfig({ targeting: { interests: null } }); // Clear all targeting keys. slot.setConfig({ targeting: null });
JavaScript (legacy)
var slot = googletag .defineSlot("/1234567/sports", [160, 600], "div") .addService(googletag.pubads()); // Setting a single targeting key-value. slot.setConfig({ targeting: { interests: "sports" } }); // Setting multiple values for a single targeting key. slot.setConfig({ targeting: { interests: ["sports", "music"] } }); // Setting multiple targeting key-values at once. slot.setConfig({ targeting: { interests: ["sports", "music"], color: "red" } }); // Clearing a single targeting key. slot.setConfig({ targeting: { interests: null } }); // Clear all targeting keys. slot.setConfig({ targeting: null });
টাইপস্ক্রিপ্ট
const slot = googletag .defineSlot("/1234567/sports", [160, 600], "div")! .addService(googletag.pubads()); // Setting a single targeting key-value. slot.setConfig({ targeting: { interests: "sports" } }); // Setting multiple values for a single targeting key. slot.setConfig({ targeting: { interests: ["sports", "music"] } }); // Setting multiple targeting key-values at once. slot.setConfig({ targeting: { interests: ["sports", "music"], color: "red" } }); // Clearing a single targeting key. slot.setConfig({ targeting: { interests: null } }); // Clear all targeting keys. slot.setConfig({ targeting: null });
- আরো দেখুন
googletag.config.TaxonomyData
| Properties | |
|---|---|
values | A list of Taxonomy values. |
Properties
values
values : readonly string []googletag.config.VideoAdsConfig
| Properties | |
|---|---|
enable Video Ads | Whether videos ads will be present on the page. |
video Cms Id ? | The video content source ID. |
video Content Id ? | The video content ID. |
- আরো দেখুন
Properties
enableVideoAds
enableVideoAds : booleanWhen set to
true , this enables content exclusion constraints on display and video ads.If the video content is known, set videoContentId and videoCmsId to the values provided to the Google Ad Manager content ingestion service to utilize content exclusion for display ads.
Optional videoCmsId
videoCmsId ?: stringThis is a unique value assigned by the Google Ad Manager content ingestion service to identify the source of video content specified by videoContentId .
- আরো দেখুন
Optional videoContentId
videoContentId ?: stringThis is a unique value that identifies a particular video from the content source specified by videoCmsId . This value is assigned by the CMS that hosts your video content.
- আরো দেখুন
googletag.enums
| Enumerations | |
|---|---|
Out Of Page Format | Out-of-page formats supported by GPT. |
Traffic Source | Traffic sources supported by GPT. |
Enumerations
OutOfPageFormat
OutOfPageFormat- আরো দেখুন
TrafficSource
TrafficSource- আরো দেখুন
| Enumeration Members | |
|---|---|
ORGANIC | Direct URL entry, site search, or app download. |
PURCHASED | Traffic redirected from properties other than owned (acquired or otherwise incentivized activity). |
googletag.events
| ইন্টারফেস | |
|---|---|
Event | Base Interface for all GPT events. |
Event Type Map | This is a pseudo-type that maps an event name to its corresponding event object type for Service.addEventListener and Service.removeEventListener . |
Game Manual Interstitial Slot Closed Event | This event is fired when a game manual interstitial slot has been closed by the user. |
Game Manual Interstitial Slot Ready Event | This event is fired when a game manual interstitial slot is ready to be shown to the user. |
Impression Viewable Event | This event is fired when an impression becomes viewable, according to the Active View criteria . |
Rewarded Slot Closed Event | This event is fired when a rewarded ad slot is closed by the user. |
Rewarded Slot Granted Event | This event is fired when a reward is granted for viewing a rewarded ad . |
Rewarded Slot Ready Event | This event is fired when a rewarded ad is ready to be displayed. |
Rewarded Slot Video Completed Event | This event is fired when a rewarded video ad has finished playing. |
Slot Onload Event | This event is fired when the creative's iframe fires its load event. |
Slot Render Ended Event | This event is fired when the creative code is injected into a slot. |
Slot Requested Event | This event is fired when an ad has been requested for a particular slot. |
Slot Response Received | This event is fired when an ad response has been received for a particular slot. |
Slot Visibility Changed Event | This event is fired whenever the on-screen percentage of an ad slot's area changes. |
googletag.events.Event
| Properties | |
|---|---|
service Name | Name of the service that triggered the event. |
slot | The slot that triggered the event. |
- আরো দেখুন
Properties
serviceName
serviceName : stringslot
slot : Slotgoogletag.events.EventTypeMap
| Properties | |
|---|---|
game Manual Interstitial Slot Closed | Alias for events.GameManualInterstitialSlotClosedEvent . |
game Manual Interstitial Slot Ready | Alias for events.GameManualInterstitialSlotReadyEvent . |
impression Viewable | Alias for events.ImpressionViewableEvent . |
rewarded Slot Closed | Alias for events.RewardedSlotClosedEvent . |
rewarded Slot Granted | Alias for events.RewardedSlotGrantedEvent . |
rewarded Slot Ready | Alias for events.RewardedSlotReadyEvent . |
rewarded Slot Video Completed | Alias for events.RewardedSlotVideoCompletedEvent . |
slot Onload | Alias for events.SlotOnloadEvent . |
slot Render Ended | Alias for events.SlotRenderEndedEvent . |
slot Requested | Alias for events.SlotRequestedEvent . |
slot Response Received | Alias for events.SlotResponseReceived . |
slot Visibility Changed | Alias for events.SlotVisibilityChangedEvent . |
Properties
gameManualInterstitialSlotClosed
gameManualInterstitialSlotClosed : GameManualInterstitialSlotClosedEventgameManualInterstitialSlotReady
gameManualInterstitialSlotReady : GameManualInterstitialSlotReadyEventimpressionViewable
impressionViewable : ImpressionViewableEventrewardedSlotClosed
rewardedSlotClosed : RewardedSlotClosedEventrewardedSlotGranted
rewardedSlotGranted : RewardedSlotGrantedEventrewardedSlotReady
rewardedSlotReady : RewardedSlotReadyEventrewardedSlotVideoCompleted
rewardedSlotVideoCompleted : RewardedSlotVideoCompletedEventslotOnload
slotOnload : SlotOnloadEventslotRenderEnded
slotRenderEnded : SlotRenderEndedEventslotRequested
slotRequested : SlotRequestedEventslotResponseReceived
slotResponseReceived : SlotResponseReceivedslotVisibilityChanged
slotVisibilityChanged : SlotVisibilityChangedEventgoogletag.events.GameManualInterstitialSlotClosedEvent
EventNote: Game manual interstitial is a limited-access format.
| Properties | |
|---|---|
service Name | Name of the service that triggered the event. Inherited from |
slot | The slot that triggered the event. Inherited from |
- উদাহরণ
জাভাস্ক্রিপ্ট
// This listener is called when a game manual interstitial slot is closed. const targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL, ); // Slot returns null if the page or device does not support game manual interstitial ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); googletag.pubads().addEventListener("gameManualInterstitialSlotClosed", (event) => { const slot = event.slot; console.log("Game manual interstital slot", slot.getSlotElementId(), "is closed."); if (slot === targetSlot) { // Slot specific logic. } }); }
JavaScript (legacy)
// This listener is called when a game manual interstitial slot is closed. var targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL, ); // Slot returns null if the page or device does not support game manual interstitial ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); googletag.pubads().addEventListener("gameManualInterstitialSlotClosed", function (event) { var slot = event.slot; console.log("Game manual interstital slot", slot.getSlotElementId(), "is closed."); if (slot === targetSlot) { // Slot specific logic. } }); }
টাইপস্ক্রিপ্ট
// This listener is called when a game manual interstitial slot is closed. const targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL, ); // Slot returns null if the page or device does not support game manual interstitial ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); googletag.pubads().addEventListener("gameManualInterstitialSlotClosed", (event) => { const slot = event.slot; console.log("Game manual interstital slot", slot.getSlotElementId(), "is closed."); if (slot === targetSlot) { // Slot specific logic. } }); }
googletag.events.GameManualInterstitialSlotReadyEvent
EventNote: Game manual interstitial is a limited-access format.
| Properties | |
|---|---|
service Name | Name of the service that triggered the event. Inherited from |
slot | The slot that triggered the event. Inherited from |
| পদ্ধতি | |
|---|---|
make Game Manual Interstitial Visible | Displays the game manual interstitial ad to the user. |
- উদাহরণ
জাভাস্ক্রিপ্ট
// This listener is called when a game manual interstitial slot is ready to // be displayed. const targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL, ); // Slot returns null if the page or device does not support game manual interstitial ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); googletag.pubads().addEventListener("gameManualInterstitialSlotReady", (event) => { const slot = event.slot; console.log( "Game manual interstital slot", slot.getSlotElementId(), "is ready to be displayed.", ); // Replace with custom logic. const displayGmiAd = true; if (displayGmiAd) { event.makeGameManualInterstitialVisible(); } if (slot === targetSlot) { // Slot specific logic. } }); }
JavaScript (legacy)
// This listener is called when a game manual interstitial slot is ready to // be displayed. var targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL, ); // Slot returns null if the page or device does not support game manual interstitial ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); googletag.pubads().addEventListener("gameManualInterstitialSlotReady", function (event) { var slot = event.slot; console.log( "Game manual interstital slot", slot.getSlotElementId(), "is ready to be displayed.", ); // Replace with custom logic. var displayGmiAd = true; if (displayGmiAd) { event.makeGameManualInterstitialVisible(); } if (slot === targetSlot) { // Slot specific logic. } }); }
টাইপস্ক্রিপ্ট
// This listener is called when a game manual interstitial slot is ready to // be displayed. const targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL, ); // Slot returns null if the page or device does not support game manual interstitial ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); googletag.pubads().addEventListener("gameManualInterstitialSlotReady", (event) => { const slot = event.slot; console.log( "Game manual interstital slot", slot.getSlotElementId(), "is ready to be displayed.", ); // Replace with custom logic. const displayGmiAd = true; if (displayGmiAd) { event.makeGameManualInterstitialVisible(); } if (slot === targetSlot) { // Slot specific logic. } }); }
পদ্ধতি
makeGameManualInterstitialVisible
makeGameManualInterstitialVisible ( ) : voidgoogletag.events.ImpressionViewableEvent
Event| Properties | |
|---|---|
service Name | Name of the service that triggered the event. Inherited from |
slot | The slot that triggered the event. Inherited from |
- উদাহরণ
জাভাস্ক্রিপ্ট
// This listener is called when an impression becomes viewable. const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("impressionViewable", (event) => { const slot = event.slot; console.log("Impression for slot", slot.getSlotElementId(), "became viewable."); if (slot === targetSlot) { // Slot specific logic. } });
JavaScript (legacy)
// This listener is called when an impression becomes viewable. var targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("impressionViewable", function (event) { var slot = event.slot; console.log("Impression for slot", slot.getSlotElementId(), "became viewable."); if (slot === targetSlot) { // Slot specific logic. } });
টাইপস্ক্রিপ্ট
// This listener is called when an impression becomes viewable. const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("impressionViewable", (event) => { const slot = event.slot; console.log("Impression for slot", slot.getSlotElementId(), "became viewable."); if (slot === targetSlot) { // Slot specific logic. } });
- আরো দেখুন
googletag.events.RewardedSlotClosedEvent
Event| Properties | |
|---|---|
service Name | Name of the service that triggered the event. Inherited from |
slot | The slot that triggered the event. Inherited from |
- উদাহরণ
জাভাস্ক্রিপ্ট
const targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.REWARDED, ); // Slot returns null if the page or device does not support rewarded ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); // This listener is called when the user closes a rewarded ad slot. googletag.pubads().addEventListener("rewardedSlotClosed", (event) => { const slot = event.slot; console.log("Rewarded ad slot", slot.getSlotElementId(), "has been closed."); if (slot === targetSlot) { // Slot specific logic. } }); }
JavaScript (legacy)
var targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.REWARDED, ); // Slot returns null if the page or device does not support rewarded ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); // This listener is called when the user closes a rewarded ad slot. googletag.pubads().addEventListener("rewardedSlotClosed", function (event) { var slot = event.slot; console.log("Rewarded ad slot", slot.getSlotElementId(), "has been closed."); if (slot === targetSlot) { // Slot specific logic. } }); }
টাইপস্ক্রিপ্ট
const targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.REWARDED, ); // Slot returns null if the page or device does not support rewarded ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); // This listener is called when the user closes a rewarded ad slot. googletag.pubads().addEventListener("rewardedSlotClosed", (event) => { const slot = event.slot; console.log("Rewarded ad slot", slot.getSlotElementId(), "has been closed."); if (slot === targetSlot) { // Slot specific logic. } }); }
- আরো দেখুন
googletag.events.RewardedSlotGrantedEvent
Event| Properties | |
|---|---|
payload | An object containing information about the reward that was granted. |
service Name | Name of the service that triggered the event. Inherited from |
slot | The slot that triggered the event. Inherited from |
- উদাহরণ
জাভাস্ক্রিপ্ট
const targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.REWARDED, ); // Slot returns null if the page or device does not support rewarded ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); // This listener is called whenever a reward is granted for a // rewarded ad. googletag.pubads().addEventListener("rewardedSlotGranted", (event) => { const slot = event.slot; console.group("Reward granted for slot", slot.getSlotElementId(), "."); // Log details of the reward. console.log("Reward type:", event.payload?.type); console.log("Reward amount:", event.payload?.amount); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } }); }
JavaScript (legacy)
var targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.REWARDED, ); // Slot returns null if the page or device does not support rewarded ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); // This listener is called whenever a reward is granted for a // rewarded ad. googletag.pubads().addEventListener("rewardedSlotGranted", function (event) { var _a, _b; var slot = event.slot; console.group("Reward granted for slot", slot.getSlotElementId(), "."); // Log details of the reward. console.log("Reward type:", (_a = event.payload) === null || _a === void 0 ? void 0 : _a.type); console.log( "Reward amount:", (_b = event.payload) === null || _b === void 0 ? void 0 : _b.amount, ); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } }); }
টাইপস্ক্রিপ্ট
const targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.REWARDED, ); // Slot returns null if the page or device does not support rewarded ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); // This listener is called whenever a reward is granted for a // rewarded ad. googletag.pubads().addEventListener("rewardedSlotGranted", (event) => { const slot = event.slot; console.group("Reward granted for slot", slot.getSlotElementId(), "."); // Log details of the reward. console.log("Reward type:", event.payload?.type); console.log("Reward amount:", event.payload?.amount); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } }); }
- আরো দেখুন
Properties
payload
payload : RewardedPayloadgoogletag.events.RewardedSlotReadyEvent
Event| Properties | |
|---|---|
service Name | Name of the service that triggered the event. Inherited from |
slot | The slot that triggered the event. Inherited from |
| পদ্ধতি | |
|---|---|
make Rewarded Visible | Displays the rewarded ad. |
- উদাহরণ
জাভাস্ক্রিপ্ট
// This listener is called when a rewarded ad slot becomes ready to be // displayed. const targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.REWARDED, ); // Slot returns null if the page or device does not support rewarded ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); // This listener is called whenever a reward is granted for a // rewarded ad. googletag.pubads().addEventListener("rewardedSlotReady", (event) => { const slot = event.slot; console.log("Rewarded ad slot", slot.getSlotElementId(), "is ready to be displayed."); // Replace with custom logic. const userHasConsented = true; if (userHasConsented) { event.makeRewardedVisible(); } if (slot === targetSlot) { // Slot specific logic. } }); }
JavaScript (legacy)
// This listener is called when a rewarded ad slot becomes ready to be // displayed. var targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.REWARDED, ); // Slot returns null if the page or device does not support rewarded ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); // This listener is called whenever a reward is granted for a // rewarded ad. googletag.pubads().addEventListener("rewardedSlotReady", function (event) { var slot = event.slot; console.log("Rewarded ad slot", slot.getSlotElementId(), "is ready to be displayed."); // Replace with custom logic. var userHasConsented = true; if (userHasConsented) { event.makeRewardedVisible(); } if (slot === targetSlot) { // Slot specific logic. } }); }
টাইপস্ক্রিপ্ট
// This listener is called when a rewarded ad slot becomes ready to be // displayed. const targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.REWARDED, ); // Slot returns null if the page or device does not support rewarded ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); // This listener is called whenever a reward is granted for a // rewarded ad. googletag.pubads().addEventListener("rewardedSlotReady", (event) => { const slot = event.slot; console.log("Rewarded ad slot", slot.getSlotElementId(), "is ready to be displayed."); // Replace with custom logic. const userHasConsented = true; if (userHasConsented) { event.makeRewardedVisible(); } if (slot === targetSlot) { // Slot specific logic. } }); }
- আরো দেখুন
পদ্ধতি
makeRewardedVisible
makeRewardedVisible ( ) : boolean| রিটার্নস | |
|---|---|
boolean | Whether the rewarded ad was successfully displayed. |
googletag.events.RewardedSlotVideoCompletedEvent
Event| Properties | |
|---|---|
service Name | Name of the service that triggered the event. Inherited from |
slot | The slot that triggered the event. Inherited from |
- উদাহরণ
জাভাস্ক্রিপ্ট
const targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.REWARDED, ); // Slot returns null if the page or device does not support rewarded ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); // This listener is called when the video in a rewarded ad slot has // finished playing. googletag.pubads().addEventListener("rewardedSlotVideoCompleted", (event) => { const slot = event.slot; console.log("Video in rewarded ad slot", slot.getSlotElementId(), "has finished playing."); if (slot === targetSlot) { // Slot specific logic. } }); }
JavaScript (legacy)
var targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.REWARDED, ); // Slot returns null if the page or device does not support rewarded ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); // This listener is called when the video in a rewarded ad slot has // finished playing. googletag.pubads().addEventListener("rewardedSlotVideoCompleted", function (event) { var slot = event.slot; console.log("Video in rewarded ad slot", slot.getSlotElementId(), "has finished playing."); if (slot === targetSlot) { // Slot specific logic. } }); }
টাইপস্ক্রিপ্ট
const targetSlot = googletag.defineOutOfPageSlot( "/1234567/example", googletag.enums.OutOfPageFormat.REWARDED, ); // Slot returns null if the page or device does not support rewarded ads. if (targetSlot) { targetSlot.addService(googletag.pubads()); // This listener is called when the video in a rewarded ad slot has // finished playing. googletag.pubads().addEventListener("rewardedSlotVideoCompleted", (event) => { const slot = event.slot; console.log("Video in rewarded ad slot", slot.getSlotElementId(), "has finished playing."); if (slot === targetSlot) { // Slot specific logic. } }); }
- আরো দেখুন
googletag.events.SlotOnloadEvent
EventSlotOnloadEvent will be fired. | Properties | |
|---|---|
service Name | Name of the service that triggered the event. Inherited from |
slot | The slot that triggered the event. Inherited from |
- উদাহরণ
জাভাস্ক্রিপ্ট
// This listener is called when a creative iframe load event fires. const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotOnload", (event) => { const slot = event.slot; console.log("Creative iframe for slot", slot.getSlotElementId(), "has loaded."); if (slot === targetSlot) { // Slot specific logic. } });
JavaScript (legacy)
// This listener is called when a creative iframe load event fires. var targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotOnload", function (event) { var slot = event.slot; console.log("Creative iframe for slot", slot.getSlotElementId(), "has loaded."); if (slot === targetSlot) { // Slot specific logic. } });
টাইপস্ক্রিপ্ট
// This listener is called when a creative iframe load event fires. const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotOnload", (event) => { const slot = event.slot; console.log("Creative iframe for slot", slot.getSlotElementId(), "has loaded."); if (slot === targetSlot) { // Slot specific logic. } });
- আরো দেখুন
googletag.events.SlotRenderEndedEvent
Event| Properties | |
|---|---|
advertiser Id | Advertiser ID of the rendered ad. |
campaign Id | Campaign ID of the rendered ad. |
company Ids | IDs of the companies that bid on the rendered backfill ad. |
creative Id | Creative ID of the rendered reservation ad. |
creative Template Id | Creative template ID of the rendered reservation ad. |
is Backfill | Whether an ad was a backfill ad. |
is Empty | Whether an ad was returned for the slot. |
label Ids | Deprecated. |
line Item Id | Line item ID of the rendered reservation ad. |
response Identifier | The response identifier is a unique identifier for the ad response. |
service Name | Name of the service that triggered the event. Inherited from |
size | Indicates the pixel size of the rendered creative. |
slot | The slot that triggered the event. Inherited from |
slot Content Changed | Whether the slot content was changed with the rendered ad. |
source Agnostic Creative Id | Creative ID of the rendered reservation or backfill ad. |
source Agnostic Line Item Id | Line item ID of the rendered reservation or backfill ad. |
yield Group Ids | IDs of the yield groups for the rendered backfill ad. |
- উদাহরণ
জাভাস্ক্রিপ্ট
// This listener is called when a slot has finished rendering. const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotRenderEnded", (event) => { const slot = event.slot; console.group("Slot", slot.getSlotElementId(), "finished rendering."); // Log details of the rendered ad. console.log("Advertiser ID:", event.advertiserId); console.log("Campaign ID:", event.campaignId); console.log("Company IDs:", event.companyIds); console.log("Creative ID:", event.creativeId); console.log("Creative Template ID:", event.creativeTemplateId); console.log("Is backfill?:", event.isBackfill); console.log("Is empty?:", event.isEmpty); console.log("Line Item ID:", event.lineItemId); console.log("Size:", event.size); console.log("Slot content changed?", event.slotContentChanged); console.log("Source Agnostic Creative ID:", event.sourceAgnosticCreativeId); console.log("Source Agnostic Line Item ID:", event.sourceAgnosticLineItemId); console.log("Yield Group IDs:", event.yieldGroupIds); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } });
JavaScript (legacy)
// This listener is called when a slot has finished rendering. var targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotRenderEnded", function (event) { var slot = event.slot; console.group("Slot", slot.getSlotElementId(), "finished rendering."); // Log details of the rendered ad. console.log("Advertiser ID:", event.advertiserId); console.log("Campaign ID:", event.campaignId); console.log("Company IDs:", event.companyIds); console.log("Creative ID:", event.creativeId); console.log("Creative Template ID:", event.creativeTemplateId); console.log("Is backfill?:", event.isBackfill); console.log("Is empty?:", event.isEmpty); console.log("Line Item ID:", event.lineItemId); console.log("Size:", event.size); console.log("Slot content changed?", event.slotContentChanged); console.log("Source Agnostic Creative ID:", event.sourceAgnosticCreativeId); console.log("Source Agnostic Line Item ID:", event.sourceAgnosticLineItemId); console.log("Yield Group IDs:", event.yieldGroupIds); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } });
TypeScript
// This listener is called when a slot has finished rendering. const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotRenderEnded", (event) => { const slot = event.slot; console.group("Slot", slot.getSlotElementId(), "finished rendering."); // Log details of the rendered ad. console.log("Advertiser ID:", event.advertiserId); console.log("Campaign ID:", event.campaignId); console.log("Company IDs:", event.companyIds); console.log("Creative ID:", event.creativeId); console.log("Creative Template ID:", event.creativeTemplateId); console.log("Is backfill?:", event.isBackfill); console.log("Is empty?:", event.isEmpty); console.log("Line Item ID:", event.lineItemId); console.log("Size:", event.size); console.log("Slot content changed?", event.slotContentChanged); console.log("Source Agnostic Creative ID:", event.sourceAgnosticCreativeId); console.log("Source Agnostic Line Item ID:", event.sourceAgnosticLineItemId); console.log("Yield Group IDs:", event.yieldGroupIds); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } });
- আরো দেখুন
Properties
advertiserId
advertiserId : numbernull for empty slots, backfill ads, and creatives rendered by services other than PubAdsService . campaignId
campaignId : numbernull for empty slots, backfill ads, and creatives rendered by services other than PubAdsService . companyIds
companyIds : number []null for empty slots, reservation ads, and creatives rendered by services other than PubAdsService . creativeId
creativeId : numbernull for empty slots, backfill ads, and creatives rendered by services other than PubAdsService . creativeTemplateId
creativeTemplateId : numbernull for empty slots, backfill ads, and creatives rendered by services other than PubAdsService . isBackfill
isBackfill : booleantrue if the ad was a backfill ad, false otherwise. isEmpty
isEmpty : booleantrue if no ad was returned, false otherwise. labelIds
labelIds : number []lineItemId
lineItemId : numbernull for empty slots, backfill ads, and creatives rendered by services other than PubAdsService . responseIdentifier
responseIdentifier : stringআকার
size : string | number [][728, 90] . Value is null for empty ad slots. slotContentChanged
slotContentChanged : booleantrue if the content was changed, false otherwise. sourceAgnosticCreativeId
sourceAgnosticCreativeId : numbernull if the ad is not a reservation or line item backfill, or the creative is rendered by services other than PubAdsService . sourceAgnosticLineItemId
sourceAgnosticLineItemId : numbernull if the ad is not a reservation or line item backfill, or the creative is rendered by services other than PubAdsService . yieldGroupIds
yieldGroupIds : number []null for empty slots, reservation ads, and creatives rendered by services other than PubAdsService . googletag.events.SlotRequestedEvent
Event| Properties | |
|---|---|
service Name | Name of the service that triggered the event. Inherited from |
slot | The slot that triggered the event. Inherited from |
- উদাহরণ
জাভাস্ক্রিপ্ট
// This listener is called when the specified service issues an ad // request for a slot. Each slot will fire this event, even though they // may be batched together in a single request if single request // architecture (SRA) is enabled. const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotRequested", (event) => { const slot = event.slot; console.log("Slot", slot.getSlotElementId(), "has been requested."); if (slot === targetSlot) { // Slot specific logic. } });
JavaScript (legacy)
// This listener is called when the specified service issues an ad // request for a slot. Each slot will fire this event, even though they // may be batched together in a single request if single request // architecture (SRA) is enabled. var targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotRequested", function (event) { var slot = event.slot; console.log("Slot", slot.getSlotElementId(), "has been requested."); if (slot === targetSlot) { // Slot specific logic. } });
TypeScript
// This listener is called when the specified service issues an ad // request for a slot. Each slot will fire this event, even though they // may be batched together in a single request if single request // architecture (SRA) is enabled. const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotRequested", (event) => { const slot = event.slot; console.log("Slot", slot.getSlotElementId(), "has been requested."); if (slot === targetSlot) { // Slot specific logic. } });
- আরো দেখুন
googletag.events.SlotResponseReceived
Event| Properties | |
|---|---|
service Name | Name of the service that triggered the event. Inherited from |
slot | The slot that triggered the event. Inherited from |
- উদাহরণ
জাভাস্ক্রিপ্ট
// This listener is called when an ad response has been received // for a slot. const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotResponseReceived", (event) => { const slot = event.slot; console.log("Ad response for slot", slot.getSlotElementId(), "received."); if (slot === targetSlot) { // Slot specific logic. } });
JavaScript (legacy)
// This listener is called when an ad response has been received // for a slot. var targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotResponseReceived", function (event) { var slot = event.slot; console.log("Ad response for slot", slot.getSlotElementId(), "received."); if (slot === targetSlot) { // Slot specific logic. } });
TypeScript
// This listener is called when an ad response has been received // for a slot. const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotResponseReceived", (event) => { const slot = event.slot; console.log("Ad response for slot", slot.getSlotElementId(), "received."); if (slot === targetSlot) { // Slot specific logic. } });
- আরো দেখুন
googletag.events.SlotVisibilityChangedEvent
Event| Properties | |
|---|---|
in View Percentage | The percentage of the ad's area that is visible. |
service Name | Name of the service that triggered the event. Inherited from |
slot | The slot that triggered the event. Inherited from |
- উদাহরণ
জাভাস্ক্রিপ্ট
// This listener is called whenever the on-screen percentage of an // ad slot's area changes. const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotVisibilityChanged", (event) => { const slot = event.slot; console.group("Visibility of slot", slot.getSlotElementId(), "changed."); // Log details of the event. console.log("Visible area:", `${event.inViewPercentage}%`); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } });
JavaScript (legacy)
// This listener is called whenever the on-screen percentage of an // ad slot's area changes. var targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotVisibilityChanged", function (event) { var slot = event.slot; console.group("Visibility of slot", slot.getSlotElementId(), "changed."); // Log details of the event. console.log("Visible area:", "".concat(event.inViewPercentage, "%")); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } });
TypeScript
// This listener is called whenever the on-screen percentage of an // ad slot's area changes. const targetSlot = googletag.defineSlot("/1234567/example", [160, 600]); googletag.pubads().addEventListener("slotVisibilityChanged", (event) => { const slot = event.slot; console.group("Visibility of slot", slot.getSlotElementId(), "changed."); // Log details of the event. console.log("Visible area:", `${event.inViewPercentage}%`); console.groupEnd(); if (slot === targetSlot) { // Slot specific logic. } });
- আরো দেখুন
Properties
inViewPercentage
inViewPercentage : numbergoogletag.secureSignals
| ইন্টারফেস | |
|---|---|
Bidder Signal Provider | Returns a secure signal for a specific bidder. |
Publisher Signal Provider | Returns a secure signal for a specific publisher. |
Secure Signal Providers Array | An interface for managing secure signals. |
| Type Aliases | |
|---|---|
Secure Signal Provider | Interface for returning a secure signal for a specific bidder or provider. |
Type Aliases
SecureSignalProvider
SecureSignalProvider : BidderSignalProvider | PublisherSignalProviderid or networkCode must be provided, but not both. googletag.secureSignals.BidderSignalProvider
A bidder secure signal provider consists of 2 parts:
- A collector function, which returns a
Promisethat resolves to a secure signal. - An
idwhich identifies the bidder associated with the signal.
| Properties | |
|---|---|
collector Function | A function which returns a Promise that resolves to a secure signal. |
id | A unique identifier for the collector associated with this secure signal, as registered in Google Ad Manager. |
- উদাহরণ
জাভাস্ক্রিপ্ট
// id is provided googletag.secureSignalProviders.push({ id: "collector123", collectorFunction: () => { // ...custom signal generation logic... return Promise.resolve("signal"); }, });
JavaScript (legacy)
// id is provided googletag.secureSignalProviders.push({ id: "collector123", collectorFunction: function () { // ...custom signal generation logic... return Promise.resolve("signal"); }, });
TypeScript
// id is provided googletag.secureSignalProviders!.push({ id: "collector123", collectorFunction: () => { // ...custom signal generation logic... return Promise.resolve("signal"); }, });
- আরো দেখুন
Properties
collectorFunction
collectorFunction : ( ( ) => Promise < string > )Promise that resolves to a secure signal. আইডি
id : stringgoogletag.secureSignals.PublisherSignalProvider
A publisher signal provider consists of 2 parts:
- A collector function, which returns a
Promisethat resolves to a secure signal. - A
networkCodewhich identifies the publisher associated with the signal.
| Properties | |
|---|---|
collector Function | A function which returns a Promise that resolves to a secure signal. |
network Code | The network code (as seen in the ad unit path) for the publisher associated with this secure signal. |
- উদাহরণ
জাভাস্ক্রিপ্ট
// networkCode is provided googletag.secureSignalProviders.push({ networkCode: "123456", collectorFunction: () => { // ...custom signal generation logic... return Promise.resolve("signal"); }, });
JavaScript (legacy)
// networkCode is provided googletag.secureSignalProviders.push({ networkCode: "123456", collectorFunction: function () { // ...custom signal generation logic... return Promise.resolve("signal"); }, });
TypeScript
// networkCode is provided googletag.secureSignalProviders!.push({ networkCode: "123456", collectorFunction: () => { // ...custom signal generation logic... return Promise.resolve("signal"); }, });
- আরো দেখুন
Properties
collectorFunction
collectorFunction : ( ( ) => Promise < string > )Promise that resolves to a secure signal. networkCode
networkCode : stringgoogletag.secureSignals.SecureSignalProvidersArray
| পদ্ধতি | |
|---|---|
clear All Cache | Clears all signals for all collectors from cache. |
push | Adds a new secureSignals.SecureSignalProvider to the signal provider array and begins the signal generation process. |
পদ্ধতি
clearAllCache
clearAllCache ( ) : voidCalling this method may reduce the likelihood of signals being included in ad requests for the current and potentially later page views. Due to this, it should only be called when meaningful state changes occur, such as events that indicate a new user (log in, log out, sign up, etc.).
ধাক্কা দেওয়া
push ( provider : SecureSignalProvider ) : void| Parameters | |
|---|---|
provider : SecureSignalProvider | The secureSignals.SecureSignalProvider object to be added to the array. |