জিপিটি রেফারেন্স

এই রেফারেন্সটি টাইপস্ক্রিপ্ট নোটেশন ব্যবহার করে প্রকারগুলি বর্ণনা করে। নিম্নলিখিত টেবিলটি উদাহরণের মাধ্যমে একটি সংক্ষিপ্ত ব্যাখ্যা প্রদান করে।

এক্সপ্রেশন টাইপ করুন
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

গুগল পাবলিশার ট্যাগ তার API-এর জন্য যে গ্লোবাল নেমস্পেস ব্যবহার করে।
নামস্থান
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 | undefined
GPT API লোড হয়েছে এবং কল করার জন্য প্রস্তুত তা নির্দেশ করে ফ্ল্যাগ করুন। API প্রস্তুত না হওয়া পর্যন্ত এই বৈশিষ্ট্যটি কেবল undefined থাকবে।

মনে রাখবেন যে async পরিচালনা করার প্রস্তাবিত উপায় হল GPT প্রস্তুত হওয়ার সময় কলব্যাকগুলি সারিবদ্ধ করার জন্য googletag.cmd ব্যবহার করা। এই কলব্যাকগুলিকে googletag.apiReady চেক করতে হবে না কারণ API সেট আপ হয়ে গেলে এগুলি কার্যকর হওয়ার নিশ্চয়তা রয়েছে।

Const সিএমডি

cmd : ( ( this : typeof globalThis ) => void ) [] | CommandArray
GPT-সম্পর্কিত কলগুলির অ্যাসিঙ্ক্রোনাস এক্সিকিউশনের জন্য গ্লোবাল কমান্ড কিউ-এর রেফারেন্স।

googletag.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 | undefined
PubAdsService সক্রিয়, লোড এবং সম্পূর্ণরূপে কার্যকরী তা নির্দেশ করে ফ্ল্যাগ করুন। enableServices কল না করা এবং PubAdsService লোড এবং ইনিশিয়ালাইজ না করা পর্যন্ত এই বৈশিষ্ট্যটি কেবল undefined থাকবে।

সিকিউরসিগন্যালপ্রোভাইডার

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 এর একটি রেফারেন্স ফেরত দেয়।
রিটার্নস
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 নেটওয়ার্ক কোড এবং বিজ্ঞাপন ইউনিট কোড সহ সম্পূর্ণ বিজ্ঞাপন ইউনিট পাথ
Optional div : string | OutOfPageFormat যে ডিভটিতে এই বিজ্ঞাপন ইউনিট বা OutOfPageFormat থাকবে তার আইডি।
রিটার্নস
Slot | null নতুন তৈরি স্লট, অথবা যদি স্লট তৈরি করা না যায় তাহলে null

ডিফাইনস্লট

defineSlot ( adUnitPath : string , size : GeneralSize , div ?: string ) : Slot | null
একটি নির্দিষ্ট বিজ্ঞাপন ইউনিট পাথ এবং আকারের সাথে একটি বিজ্ঞাপন স্লট তৈরি করে এবং এটিকে সেই পৃষ্ঠার একটি div উপাদানের ID এর সাথে সংযুক্ত করে যেখানে বিজ্ঞাপনটি থাকবে।
উদাহরণ

জাভাস্ক্রিপ্ট

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 যোগ করা স্লটের প্রস্থ এবং উচ্চতা। যদি কোনও প্রতিক্রিয়াশীল আকারের ম্যাপিং প্রদান করা না হয় অথবা ভিউপোর্টের আকার ম্যাপিংয়ে প্রদত্ত ক্ষুদ্রতম আকারের চেয়ে ছোট হয়, তাহলে বিজ্ঞাপনের অনুরোধে এই আকারটি ব্যবহার করা হয়।
Optional div : string এই বিজ্ঞাপন ইউনিটটি যে ডিভটিতে থাকবে তার আইডি।
রিটার্নস
Slot | null নতুন তৈরি স্লট, অথবা যদি স্লট তৈরি করা না যায় তাহলে null

ধ্বংস স্লট

destroySlots ( slots ?: Slot [] ) : boolean
প্রদত্ত স্লটগুলি ধ্বংস করে, GPT থেকে সেই স্লটগুলির সমস্ত সম্পর্কিত বস্তু এবং রেফারেন্সগুলি সরিয়ে দেয়। এই API পাসব্যাক স্লট এবং কম্প্যানিয়ন স্লটগুলিকে সমর্থন করে না।

এই 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();
পরামিতি
Optional slots : Slot [] ধ্বংস করার জন্য স্লটের অ্যারে। অ্যারে ঐচ্ছিক; যদি এটি নির্দিষ্ট না থাকে তবে সমস্ত স্লট ধ্বংস হয়ে যাবে।
রিটার্নস
boolean স্লট ধ্বংস হয়ে গেলে true , অন্যথায় false

প্রকাশক কনসোল অক্ষম করুন

disablePublisherConsole ( ) : void
Google প্রকাশক কনসোল অক্ষম করে।
আরো দেখুন

প্রদর্শন

display ( divOrSlot : string | Element | Slot ) : void
স্লট পরিষেবাগুলিকে স্লট রেন্ডার করার নির্দেশ দেয়। প্রতিটি বিজ্ঞাপন স্লট প্রতি পৃষ্ঠায় শুধুমাত্র একবার প্রদর্শিত হওয়া উচিত। সমস্ত স্লটকে সংজ্ঞায়িত করতে হবে এবং প্রদর্শনের আগে তাদের সাথে একটি পরিষেবা যুক্ত করতে হবে। DOM-এ উপাদানটি উপস্থিত না হওয়া পর্যন্ত প্রদর্শন কল করা উচিত নয়। এটি অর্জনের স্বাভাবিক উপায় হল মেথড কলে নামকরণ করা div উপাদানের মধ্যে একটি স্ক্রিপ্ট ব্লকের মধ্যে এটি স্থাপন করা।

যদি একক অনুরোধ আর্কিটেকচার (SRA) ব্যবহার করা হয়, তাহলে এই পদ্ধতিটি কল করার সময় সমস্ত আনফেক্টেড বিজ্ঞাপন স্লট একবারে আনা হবে। একটি বিজ্ঞাপন স্লট যাতে প্রদর্শিত না হয় তার জন্য, সম্পূর্ণ ডিভটি সরিয়ে ফেলতে হবে।
আরো দেখুন
পরামিতি
divOrSlot : string | Element | Slot হয় বিজ্ঞাপন স্লট ধারণকারী div উপাদানের ID অথবা div উপাদান, অথবা slot বস্তু। যদি একটি div উপাদান প্রদান করা হয়, তাহলে এটিতে একটি 'id' বৈশিষ্ট্য থাকতে হবে যা defineSlot এ পাস করা ID এর সাথে মেলে।

পরিষেবাগুলি সক্ষম করুন

enableServices ( ) : void
পৃষ্ঠার বিজ্ঞাপন স্লটের জন্য নির্ধারিত সমস্ত GPT পরিষেবা সক্ষম করে।

getConfig সম্পর্কে

getConfig ( keys : string | string [] ) : Pick < PageSettingsConfig , "adsenseAttributes" | "disableInitialLoad" | "targeting" >
setConfig দ্বারা সেট করা পৃষ্ঠার জন্য সাধারণ কনফিগারেশন বিকল্পগুলি পায়।

এই পদ্ধতিতে সমস্ত 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
GPT এর বর্তমান সংস্করণটি ফেরত পাঠায়।
আরো দেখুন
রিটার্নস
string বর্তমানে চলমান GPT সংস্করণ স্ট্রিং।

ওপেনকনসোল

openConsole ( div ?: string ) : void
Google প্রকাশক কনসোল খোলে।
উদাহরণ

জাভাস্ক্রিপ্ট

// 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();
আরো দেখুন
পরামিতি
Optional div : string একটি বিজ্ঞাপন স্লট ডিভ আইডি। এই মানটি ঐচ্ছিক। প্রদান করা হলে, প্রকাশক কনসোল নির্দিষ্ট বিজ্ঞাপন স্লটের বিবরণ সামনে রেখে খোলার চেষ্টা করবে।

পাবডস

pubads ( ) : PubAdsService
PubAdsService এর একটি রেফারেন্স ফেরত দেয়।
রিটার্নস
PubAdsService প্রকাশক বিজ্ঞাপন পরিষেবা।

সেটএডিফ্রেমটাইটেল

setAdIframeTitle ( title : string ) : void
এই বিন্দু থেকে, PubAdsService দ্বারা তৈরি সমস্ত বিজ্ঞাপন কন্টেইনার আইফ্রেমের শিরোনাম সেট করে।
উদাহরণ

জাভাস্ক্রিপ্ট

googletag.setAdIframeTitle("title");

জাভাস্ক্রিপ্ট (উত্তরাধিকার)

googletag.setAdIframeTitle("title");

টাইপস্ক্রিপ্ট

googletag.setAdIframeTitle("title");
পরামিতি
title : string সকল বিজ্ঞাপন কন্টেইনার আইফ্রেমের জন্য নতুন শিরোনাম।

সেটকনফিগ

setConfig ( config : PageSettingsConfig ) : void
পৃষ্ঠার জন্য সাধারণ কনফিগারেশন বিকল্পগুলি সেট করে।
পরামিতি
config : PageSettingsConfig

আকার ম্যাপিং

sizeMapping ( ) : SizeMappingBuilder
একটি নতুন SizeMappingBuilder তৈরি করে।
আরো দেখুন
রিটার্নস
SizeMappingBuilder একজন নতুন নির্মাতা।

গুগলট্যাগ.কমান্ডঅ্যারে

কমান্ড অ্যারে ফাংশনের একটি ক্রম গ্রহণ করে এবং সেগুলিকে ক্রমানুসারে আহ্বান করে। এটি একটি স্ট্যান্ডার্ড অ্যারে প্রতিস্থাপন করার উদ্দেশ্যে তৈরি করা হয়েছে যা GPT লোড হওয়ার পরে ফাংশনগুলিকে আহ্বান করার জন্য এনকিউ করতে ব্যবহৃত হয়।
পদ্ধতি
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());
});
পরামিতি
Rest ... f : ( ( this : typeof globalThis ) => void ) [] একটি জাভাস্ক্রিপ্ট ফাংশন এক্সিকিউট করতে হবে। রানটাইম বাইন্ডিং সর্বদা 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 ?: boolean
পৃষ্ঠাটিকে শিশু-নির্দেশিত হিসেবে বিবেচনা করা উচিত কিনা তা নির্দেশ করে। কনফিগারেশন সাফ করতে null এ সেট করুন।

Optional সীমিত বিজ্ঞাপন

limitedAds ?: boolean
প্রকাশকের নিয়ন্ত্রক সম্মতির চাহিদা পূরণে সহায়তা করার জন্য সীমিত বিজ্ঞাপন মোডে পরিবেশন সক্ষম করে।

আপনি GPT-কে দুটি উপায়ে সীমিত বিজ্ঞাপনের অনুরোধ করার নির্দেশ দিতে পারেন:
  • স্বয়ংক্রিয়ভাবে, IAB TCF v2.0 সম্মতি ব্যবস্থাপনা প্ল্যাটফর্ম থেকে একটি সংকেত ব্যবহার করে।
  • ম্যানুয়ালি, এই ক্ষেত্রের মান true তে সেট করে।
সীমিত বিজ্ঞাপনের URL থেকে GPT লোড করা হলেই কেবল সীমিত বিজ্ঞাপন ম্যানুয়ালি কনফিগার করা সম্ভব। স্ট্যান্ডার্ড URL থেকে GPT লোড করা হলে এই সেটিংটি পরিবর্তন করার চেষ্টা করলে একটি প্রকাশক কনসোল সতর্কতা তৈরি হবে।

মনে রাখবেন যে, যখন কোনও 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 ?: TrafficSource
অনুরোধগুলি ক্রয়কৃত নাকি জৈব ট্র্যাফিকের প্রতিনিধিত্ব করে তা নির্দেশ করে। এই মানটি বিজ্ঞাপন ম্যানেজার রিপোর্টিংয়ে ট্র্যাফিক সোর্স মাত্রা পূরণ করে। যদি সেট না করা থাকে, তাহলে রিপোর্টিংয়ে ট্র্যাফিক সোর্স ডিফল্টভাবে undefined হয়ে যায়।
উদাহরণ

জাভাস্ক্রিপ্ট

// 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 ?: boolean
সম্মতির বয়সের কম বয়সী ব্যবহারকারীদের কাছ থেকে আসা বিজ্ঞাপনের অনুরোধগুলি চিহ্নিত করা হবে কিনা তা নির্দেশ করে। কনফিগারেশনটি সাফ করতে null এ সেট করুন।

গুগলট্যাগ.পাবঅ্যাডসসার্ভিস

Service প্রসারিত করে
প্রকাশক বিজ্ঞাপন পরিষেবা। এই পরিষেবাটি আপনার Google বিজ্ঞাপন পরিচালক অ্যাকাউন্ট থেকে বিজ্ঞাপন আনতে এবং দেখানোর জন্য ব্যবহৃত হয়।
পদ্ধতি
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();
পরামিতি
Optional slots : Slot [] সাফ করার জন্য স্লটের অ্যারে। অ্যারে ঐচ্ছিক; যদি এটি নির্দিষ্ট না থাকে তবে সমস্ত স্লট সাফ করা হবে।
রিটার্নস
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.
আরো দেখুন
পরামিতি
Optional key : string টার্গেটিং প্যারামিটার কী। কীটি ঐচ্ছিক; যদি এটি নির্দিষ্ট না থাকে তবে সমস্ত টার্গেটিং প্যারামিটার সাফ করা হবে।
রিটার্নস
PubAdsService যে পরিষেবা অবজেক্টে পদ্ধতিটি কল করা হয়েছিল।

ধসে পড়া খালি ডিভস

collapseEmptyDivs ( collapseBeforeAdFetch ?: boolean ) : boolean
স্লট ডিভগুলিকে সঙ্কুচিত করা সক্ষম করে যাতে প্রদর্শনের জন্য কোনও বিজ্ঞাপন সামগ্রী না থাকলে পৃষ্ঠায় কোনও স্থান না নেয়। পরিষেবাটি সক্ষম করার আগে এই মোডটি সেট করতে হবে।
আরো দেখুন
পরামিতি
Optional collapseBeforeAdFetch : boolean বিজ্ঞাপনগুলি আনার আগেই স্লটগুলি আড়াল করা হবে কিনা। এই প্যারামিটারটি ঐচ্ছিক; যদি না দেওয়া হয়, তাহলে ডিফল্ট মান হিসেবে false ব্যবহার করা হবে।
রিটার্নস
boolean যদি div collapse মোড সক্রিয় থাকে তাহলে true এবং যদি collapse মোড সক্রিয় করা অসম্ভব হয় তাহলে false প্রদান করে কারণ পরিষেবা সক্রিয় করার পরে পদ্ধতিটি কল করা হয়েছিল।

প্রাথমিক লোড বন্ধ করুন

disableInitialLoad ( ) : void
পৃষ্ঠা লোডের সময় বিজ্ঞাপনের অনুরোধ অক্ষম করে, কিন্তু PubAdsService.refresh কলের মাধ্যমে বিজ্ঞাপনের অনুরোধ করার অনুমতি দেয়। পরিষেবাটি সক্ষম করার আগে এটি সেট করা উচিত। অ্যাসিঙ্ক মোড ব্যবহার করতে হবে; অন্যথায় refresh ব্যবহার করে বিজ্ঞাপনের অনুরোধ করা অসম্ভব হবে।
আরো দেখুন

প্রদর্শন

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 স্লটের প্রস্থ এবং উচ্চতা।
Optional div : string | Element হয় স্লট ধারণকারী div-এর ID, অথবা div উপাদানটি নিজেই।
Optional clickUrl : string এই স্লটে ব্যবহার করার জন্য ক্লিক URL।

লেজিলোড সক্ষম করুন

enableLazyLoad ( config ?: {
  fetchMarginPercent ?: number ;
  mobileScaling ?: number ;
  renderMarginPercent ?: number ;
} ) : void
কনফিগ অবজেক্ট দ্বারা সংজ্ঞায়িত GPT-তে লেজি লোডিং সক্ষম করে। আরও বিস্তারিত উদাহরণের জন্য, লেজি লোডিং নমুনা দেখুন।

দ্রষ্টব্য: 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,
});
আরো দেখুন
পরামিতি
Optional config : {
  fetchMarginPercent ?: number ;
  mobileScaling ?: number ;
  renderMarginPercent ?: number ;
}
কনফিগারেশন অবজেক্ট অলস আচরণের কাস্টমাইজেশনের অনুমতি দেয়। যেকোনো বাদ দেওয়া কনফিগারেশন Google দ্বারা সেট করা একটি ডিফল্ট সেট ব্যবহার করবে যা সময়ের সাথে সাথে টিউন করা হবে। একটি নির্দিষ্ট সেটিং, যেমন একটি ফেচিং মার্জিন, অক্ষম করতে মানটি -1 এ সেট করুন।
  • fetchMarginPercent

    ভিউপোর্টের আকারের শতাংশ হিসেবে বিজ্ঞাপনটি আনার আগে একটি স্লটের বর্তমান ভিউপোর্ট থেকে সর্বনিম্ন দূরত্ব অবশ্যই হতে হবে। ০ এর মান হল "যখন স্লটটি ভিউপোর্টে প্রবেশ করে", ১০০ এর মান হল "যখন বিজ্ঞাপনটি ১ ভিউপোর্ট দূরে থাকে", ইত্যাদি।
  • renderMarginPercent

    একটি বিজ্ঞাপন রেন্ডার করার আগে বর্তমান ভিউপোর্ট থেকে একটি স্লটের সর্বনিম্ন দূরত্ব অবশ্যই হতে হবে। এটি বিজ্ঞাপনটি প্রিফেচ করার অনুমতি দেয়, তবে অন্যান্য সাবরিসোর্সগুলি রেন্ডার এবং ডাউনলোড করার জন্য অপেক্ষা করে। মানটি ভিউপোর্টের শতাংশ হিসাবে fetchMarginPercent মতোই কাজ করে।
  • mobileScaling

    মোবাইল ডিভাইসের মার্জিনে একটি গুণক প্রয়োগ করা হয়। এটি মোবাইল বনাম ডেস্কটপে মার্জিনে পরিবর্তন আনতে সাহায্য করে। উদাহরণস্বরূপ, 2.0 মান মোবাইল ডিভাইসে সমস্ত মার্জিনকে 2 দিয়ে গুণ করবে, যা আনা এবং রেন্ডার করার আগে একটি স্লটের সর্বনিম্ন দূরত্ব বাড়িয়ে দেবে।

সিঙ্গেলরিকোয়েস্ট সক্ষম করুন

enableSingleRequest ( ) : boolean
একই সময়ে একাধিক বিজ্ঞাপন আনার জন্য একক অনুরোধ মোড সক্ষম করে। এর জন্য পরিষেবাটি সক্ষম করার আগে সমস্ত প্রকাশক বিজ্ঞাপন স্লট সংজ্ঞায়িত করতে হবে এবং Publisher AdsService-এ যোগ করতে হবে। পরিষেবাটি সক্ষম করার আগে একক অনুরোধ মোড সেট করতে হবে।
আরো দেখুন
রিটার্নস
boolean একক অনুরোধ মোড সক্রিয় থাকলে true এবং একক অনুরোধ মোড সক্রিয় করা অসম্ভব হলে false প্রদান করে কারণ পরিষেবা সক্রিয় হওয়ার পরে পদ্ধতিটি কল করা হয়েছিল।

ভিডিও বিজ্ঞাপন সক্ষম করুন

enableVideoAds ( ) : void
GPT-কে সংকেত দেয় যে পৃষ্ঠায় ভিডিও বিজ্ঞাপন উপস্থিত থাকবে। এটি প্রদর্শন এবং ভিডিও বিজ্ঞাপনগুলিতে প্রতিযোগিতামূলক বর্জন সীমাবদ্ধতা সক্ষম করে। যদি ভিডিও সামগ্রীটি জানা থাকে, তাহলে প্রদর্শন বিজ্ঞাপনের জন্য সামগ্রী বর্জন ব্যবহার করতে PubAdsService.setVideoContent-এ কল করুন।

পাওয়া

get ( key : string ) : string
প্রদত্ত কী-এর সাথে সম্পর্কিত AdSense অ্যাট্রিবিউটের মান প্রদান করে।
উদাহরণ

জাভাস্ক্রিপ্ট

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
পূর্ববর্তী PubAdsService.disableInitialLoad কলের মাধ্যমে বিজ্ঞাপনের জন্য প্রাথমিক অনুরোধগুলি সফলভাবে অক্ষম করা হয়েছে কিনা তা দেখায়।
রিটার্নস
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 });
আরো দেখুন
পরামিতি
Optional slots : Slot [] রিফ্রেশ করার জন্য স্লট। অ্যারে ঐচ্ছিক; যদি এটি নির্দিষ্ট না থাকে তবে সমস্ত স্লট রিফ্রেশ করা হবে।
Optional options : {
  changeCorrelator : boolean ;
}
এই রিফ্রেশ কলের সাথে সম্পর্কিত কনফিগারেশন বিকল্পগুলি।
  • changeCorrelator

    বিজ্ঞাপন আনার জন্য একটি নতুন কোরিলেটর তৈরি করা হবে কিনা তা নির্দিষ্ট করে। আমাদের বিজ্ঞাপন সার্ভারগুলি এই কোরিলেটর মানটি সংক্ষিপ্তভাবে বজায় রাখে (বর্তমানে 30 সেকেন্ডের জন্য, তবে পরিবর্তন সাপেক্ষে), যাতে কাছাকাছি প্রাপ্ত একই কোরিলেটরের অনুরোধগুলিকে একক পৃষ্ঠা দর্শন হিসাবে বিবেচনা করা হয়। ডিফল্টরূপে প্রতিটি রিফ্রেশের জন্য একটি নতুন কোরিলেটর তৈরি হয়।

    দ্রষ্টব্য: এই বিকল্পটি GPT-এর দীর্ঘস্থায়ী পেজভিউ-এর উপর কোনও প্রভাব ফেলবে না, যা স্বয়ংক্রিয়ভাবে পৃষ্ঠায় বর্তমানে থাকা বিজ্ঞাপনগুলিকে প্রতিফলিত করে এবং এর কোনও মেয়াদ শেষ হওয়ার সময় নেই।

সেট

set ( key : string , value : string ) : PubAdsService
প্রকাশক বিজ্ঞাপন পরিষেবার অধীনে সমস্ত বিজ্ঞাপন স্লটে প্রযোজ্য AdSense বৈশিষ্ট্যের মান সেট করে।

একই কী-এর জন্য একাধিকবার এটি কল করলে সেই কী-এর জন্য পূর্বে সেট করা মানগুলি ওভাররাইড হবে। 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
বিজ্ঞাপনের অনুভূমিক কেন্দ্রীকরণ সক্ষম এবং অক্ষম করে। কেন্দ্রীকরণ ডিফল্টরূপে অক্ষম থাকে। লিগ্যাসি gpt_mobile.js-এ, কেন্দ্রীকরণ ডিফল্টরূপে সক্ষম থাকে।

এই পদ্ধতিটি 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
একটি কনফিগ অবজেক্ট ব্যবহার করে একটি একক API থেকে সমস্ত গোপনীয়তা সেটিংস কনফিগার করার অনুমতি দেয়।
উদাহরণ

জাভাস্ক্রিপ্ট

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
একটি নির্দিষ্ট কী-এর জন্য কাস্টম টার্গেটিং প্যারামিটার সেট করে যা সমস্ত প্রকাশক বিজ্ঞাপন পরিষেবা বিজ্ঞাপন স্লটে প্রযোজ্য। একই কী-এর জন্য এটিকে একাধিকবার কল করলে পুরানো মানগুলি ওভাররাইট হয়ে যাবে। এই কীগুলি আপনার Google বিজ্ঞাপন ম্যানেজার অ্যাকাউন্টে সংজ্ঞায়িত করা আছে।
উদাহরণ

জাভাস্ক্রিপ্ট

// 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 ) : void
লক্ষ্যবস্তু এবং কন্টেন্ট বাদ দেওয়ার উদ্দেশ্যে বিজ্ঞাপনের অনুরোধের সাথে পাঠানো ভিডিও কন্টেন্টের তথ্য সেট করে। এই পদ্ধতিটি কল করা হলে ভিডিও বিজ্ঞাপনগুলি স্বয়ংক্রিয়ভাবে সক্ষম হবে। videoContentId এবং 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
একটি লিসেনার নিবন্ধন করে যা আপনাকে পৃষ্ঠায় একটি নির্দিষ্ট GPT ইভেন্ট ঘটলে একটি জাভাস্ক্রিপ্ট ফাংশন সেট আপ এবং কল করতে দেয়। নিম্নলিখিত ইভেন্টগুলি সমর্থিত: An object of the appropriate event type is passed to the listener when it is called.
উদাহরণ

জাভাস্ক্রিপ্ট

// 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

getSlots ( ) : Slot []
Get the list of slots associated with this service.
রিটার্নস
Slot [] Slots in the order in which they were added to the service.

removeEventListener

removeEventListener < K extends keyof EventTypeMap > ( eventType : K , listener : ( ( event : EventTypeMap [ K ] ) => void ) ) : void
Removes a previously registered listener.
উদাহরণ

জাভাস্ক্রিপ্ট

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

Builder for size mapping specification objects. This builder is provided to help easily construct size specifications.
পদ্ধতি
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
Adds a mapping from a single-size array (representing the viewport) to a single- or multi-size array representing the slot.
উদাহরণ

জাভাস্ক্রিপ্ট

// 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 &lt; 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 &lt; 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 &lt; 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 ( ) : SizeMappingArray
Builds a size map specification from the mappings added to this builder.

If 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

Slot is an object representing a single ad slot on a page.
পদ্ধতি
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
Adds a Service to this 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
Clears all slot-level ad category exclusion labels for this 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
Clears specific or all custom slot-level targeting parameters for this 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.
আরো দেখুন
পরামিতি
Optional key : string 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
Sets an array of mappings from a minimum viewport size to slot size for this 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
Returns the value for the AdSense attribute associated with the given key for this slot. To see service-level attributes inherited by this slot, use PubAdsService.get .
উদাহরণ

জাভাস্ক্রিপ্ট

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
Returns the full path of the ad unit, with the network code and ad unit path.
উদাহরণ

জাভাস্ক্রিপ্ট

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 []
Returns the list of attribute keys set on this slot. To see the keys of service-level attributes inherited by this slot, use PubAdsService.getAttributeKeys .
উদাহরণ

জাভাস্ক্রিপ্ট

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 []
Returns the ad category exclusion labels for this slot.
উদাহরণ

জাভাস্ক্রিপ্ট

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" >
Gets general configuration options for the slot set by setConfig .

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 ( ) : ResponseInformation
Returns the ad response information. This is based on the last ad response for the slot. If this is called when the slot has no ad, null will be returned.
রিটার্নস
ResponseInformation The latest ad response information, or null if the slot has no ad.

getSlotElementId

getSlotElementId ( ) : string
Returns the ID of the slot div 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 []
Returns a specific custom targeting parameter set on this slot. Service-level targeting parameters are not included.
উদাহরণ

জাভাস্ক্রিপ্ট

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 []
Returns the list of all custom targeting keys set on this slot. Service-level targeting keys are not included.
উদাহরণ

জাভাস্ক্রিপ্ট

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 ) : Slot
Sets a value for an AdSense attribute on this ad slot. This will override any values set at the service level for this key.

Calling 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
Sets a slot-level ad category exclusion label on this 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 ) : Slot
Sets the click URL to which users will be redirected after clicking on the ad.

The 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 ) : Slot
Sets whether the slot div 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.
Optional collapseBeforeAdFetch : boolean 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
Sets general configuration options for this slot.
পরামিতি
slotConfig : SlotSettingsConfig The configuration object.

setForceSafeFrame

setForceSafeFrame ( forceSafeFrame : boolean ) : Slot
Configures whether ads in this slot should be forced to be rendered using a SafeFrame container.

Please 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 false or 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 ) : Slot
Sets the slot-level preferences for SafeFrame configuration. Any unrecognized keys in the config object will be ignored. The entire config will be ignored if an invalid value is passed for a recognized key.

These 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
Sets a custom targeting parameter for this slot. Calling this method multiple times for the same key will overwrite old values. Values set here will overwrite targeting parameters set at the service-level. These keys are defined in your Google Ad Manager account.
উদাহরণ

জাভাস্ক্রিপ্ট

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
Sets custom targeting parameters for this slot, from a key:value map in a JSON object. This is the same as calling Slot.setTargeting for all the key values of the object. These keys are defined in your Google Ad Manager account.

নোট:
  • 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 : {
  [ adUnitPath : string ] : string | string [] ;
}
Targeting parameter key:value map.
রিটার্নস
Slot The slot object on which the method was called.

googletag.config

Main configuration interface for page-level settings.
ইন্টারফেস
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"
Supported values for controlling the collapsing behavior of ad slots.
আরো দেখুন

InterstitialTrigger

InterstitialTrigger : "unhideWindow" | "navBar"
Supported interstitial ad triggers.

PrivacyTreatment

PrivacyTreatment : "disablePersonalization"
Supported publisher privacy treatments.

Taxonomy

Taxonomy : "IAB_AUDIENCE_1_1" | "IAB_CONTENT_2_2"
Supported taxonomies for publisher provided signals (PPS) .
আরো দেখুন

googletag.config.AdExpansionConfig

Settings to control ad expansion.
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 ?: boolean
Whether ad expansion is enabled or disabled.

Setting this value overrides the default configured in Google Ad Manager.
আরো দেখুন

googletag.config.AdSenseAttributesConfig

Settings to control the behavior of AdSense ads.

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"
AdSense ad format.

Optional adsense_channel_ids

adsense_channel_ids ?: string
AdSense channel IDs.

Allowed values are channel IDs separated by '+'.

Example: 271828183+314159265
আরো দেখুন

Optional adsense_test_mode

adsense_test_mode ?: "on"
Whether or not test mode is enabled.

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 ?: string
Language of the page on which ads are displayed.

Allowed values are valid ISO 639-1 language codes.

Example: en
আরো দেখুন

Optional page_url

page_url ?: string
URL of the page on which ads are displayed.

Allowed values are valid URLs.

Example: http://www.example.com

googletag.config.ComponentAuctionConfig

An object representing a single component auction in a on-device ad auction.
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 ;
}
An auction configuration object for this component auction.

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 : string
The configuration key associated with this component auction.

This 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

An object which defines the behavior of a single interstitial ad slot.
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 ?: boolean
Whether local storage consent is required to display this interstitial ad.

GPT 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 > >
The interstitial trigger configuration for this interstitial ad.

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

Settings to control the use of lazy loading in GPT.
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 ?: number
The minimum distance from the current viewport a slot must be before we request an ad, expressed as a percentage of viewport size.

Used 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 ?: number
A multiplier applied to margins on mobile devices. This multiplier is applied to both fetchMarginPercent and renderMarginPercent .

This 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 ?: number
The minimum distance from the current viewport a slot must be before we render an ad, expressed as a percentage of viewport size.

Used 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

Main configuration interface for page-level settings.

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
Settings to control ad expansion.

Optional adsenseAttributes

adsenseAttributes ?: AdSenseAttributesConfig
Setting to configure AdSense attributes.

AdSense 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 []
Setting to configure ad category exclusions.
উদাহরণ

জাভাস্ক্রিপ্ট

// 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 ?: boolean
Setting to control the horizontal centering of ads. Centering is disabled by default.

Horizontal 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 ?: CollapseDivBehavior
Setting to control the collapsing behavior of ad slots.

A 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 ?: boolean
Setting to control when ads are requested.

By 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 ?: LazyLoadConfig
Settings to control the use of lazy loading in GPT.

Lazy 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
Setting to geo-target line items to geographic locations.
উদাহরণ

জাভাস্ক্রিপ্ট

// 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

Settings to control publisher provided signals (PPS).

Optional privacyTreatments

privacyTreatments ?: PrivacyTreatmentsConfig
Settings to control publisher privacy treatments.

Optional safeFrame

safeFrame ?: SafeFrameConfig
Settings to control the use of SafeFrame in GPT.

Values 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 ?: boolean
Setting to enable or disable Single Request Architecture (SRA).

When 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 [] >
Setting to control key-value targeting.

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"
Setting to control whether GPT should yield the JS thread when requesting and rendering creatives.

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
Settings to control video ads.
উদাহরণ

জাভাস্ক্রিপ্ট

// 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

Settings to control publisher privacy treatments.
Properties
treatments
An array of publisher privacy treatments to enable.

Properties


চিকিৎসা

treatments : "disablePersonalization" []
An array of publisher privacy treatments to enable.
উদাহরণ

জাভাস্ক্রিপ্ট

// 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

Publisher provided signals (PPS) configuration object.
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 > >
An object containing Taxonomy mappings or null to clear the config.

googletag.config.SafeFrameConfig

Settings to control SafeFrame in GPT.
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
Whether SafeFrame should allow ad content to expand by overlaying page content.

Optional allowPushExpansion

allowPushExpansion ?: boolean
Whether SafeFrame should allow ad content to expand by pushing page content.

Optional forceSafeFrame

forceSafeFrame ?: boolean
Whether ad(s) should be forced to be rendered using a SafeFrame container.

Optional sandbox

sandbox ?: boolean
Whether SafeFrame should use the HTML5 sandbox attribute to prevent top level navigation without user interaction. The only valid value is true (cannot be forced to false ). Note that the sandbox attribute disables plugins (eg Flash).

Optional useUniqueDomain

useUniqueDomain ?: boolean
Whether SafeFrame should use randomized subdomains for Reservation creatives. Pass in null to clear the stored value.

Note: this feature is enabled by default.
আরো দেখুন

googletag.config.SlotSettingsConfig

Main configuration interface for slot-level settings.

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
Settings to configure ad expansion.
আরো দেখুন

Optional adsenseAttributes

adsenseAttributes ?: AdSenseAttributesConfig
Setting to configure AdSense attributes.

AdSense 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 []
Setting to configure ad category exclusions.
উদাহরণ

জাভাস্ক্রিপ্ট

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 ?: string
Setting to configure the URL to which users will be redirected after clicking on the ad.

The 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 ?: CollapseDivBehavior
Setting to configure the collapsing behavior of the ad slot.

A 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 []
An array of component auctions to be included in an on-device ad auction.

Optional interstitial

interstitial ?: InterstitialConfig
Settings that configure interstitial ad slot behavior.
আরো দেখুন

Optional safeFrame

safeFrame ?: SafeFrameConfig
Settings to configure the use of SafeFrame in GPT.

Values 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 [] >
Setting to configure key-value targeting.

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

An object containing the values for a single Taxonomy .
Properties
values
A list of Taxonomy values.

Properties


values

values : readonly string []
A list of Taxonomy values.

googletag.config.VideoAdsConfig

Settings to configure video ad related settings.
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 : boolean
Whether videos ads will be present on the page.

When 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 ?: string
The video content source ID.

This 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 ?: string
The video content ID.

This 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

This is the namespace that GPT uses for enum types.
Enumerations
Out Of Page Format
Out-of-page formats supported by GPT.
Traffic Source
Traffic sources supported by GPT.

Enumerations


OutOfPageFormat

OutOfPageFormat
Out-of-page formats supported by GPT.
আরো দেখুন
Enumeration Members
AD_ INTENTS
Ad Intents format.
BOTTOM_ ANCHOR
Anchor format where slot sticks to the bottom of the viewport.
GAME_ MANUAL_ INTERSTITIAL
Game manual interstitial format.

Note: Game manual interstitial is a limited-access format.
INTERSTITIAL
Web interstitial creative format.
LEFT_ SIDE_ RAIL
Left side rail format.
REWARDED
Rewarded format.
RIGHT_ SIDE_ RAIL
Right side rail format.
TOP_ ANCHOR
Anchor format where slot sticks to the top of the viewport.

TrafficSource

TrafficSource
Traffic sources supported by GPT.
আরো দেখুন
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

This is the namespace that GPT uses for Events. Your code can react to these events using Service.addEventListener.
ইন্টারফেস
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

Base Interface for all GPT events. All GPT events below will have the following fields.
Properties
service Name
Name of the service that triggered the event.
slot
The slot that triggered the event.
আরো দেখুন

Properties


serviceName

serviceName : string
Name of the service that triggered the event.

slot

slot : Slot
The slot that triggered the event.

googletag.events.EventTypeMap

This is a pseudo-type that maps an event name to its corresponding event object type for Service.addEventListener and Service.removeEventListener . It is documented for reference and type safety purposes only.
Properties
game Manual Interstitial Slot Closed
game Manual Interstitial Slot Ready
impression Viewable
rewarded Slot Closed
rewarded Slot Granted
rewarded Slot Ready
rewarded Slot Video Completed
slot Onload
slot Render Ended
slot Requested
slot Response Received
slot Visibility Changed

Properties


gameManualInterstitialSlotClosed


gameManualInterstitialSlotReady


impressionViewable

impressionViewable : ImpressionViewableEvent
Alias for events.ImpressionViewableEvent .

rewardedSlotClosed

rewardedSlotClosed : RewardedSlotClosedEvent
Alias for events.RewardedSlotClosedEvent .

rewardedSlotGranted

rewardedSlotGranted : RewardedSlotGrantedEvent
Alias for events.RewardedSlotGrantedEvent .

rewardedSlotReady

rewardedSlotReady : RewardedSlotReadyEvent
Alias for events.RewardedSlotReadyEvent .

rewardedSlotVideoCompleted


slotOnload

slotOnload : SlotOnloadEvent
Alias for events.SlotOnloadEvent .

slotRenderEnded

slotRenderEnded : SlotRenderEndedEvent
Alias for events.SlotRenderEndedEvent .

slotRequested

slotRequested : SlotRequestedEvent
Alias for events.SlotRequestedEvent .

slotResponseReceived

slotResponseReceived : SlotResponseReceived
Alias for events.SlotResponseReceived .

slotVisibilityChanged


googletag.events.GameManualInterstitialSlotClosedEvent

Extends Event
This event is fired when a game manual interstitial slot has been closed by the user.

Note: Game manual interstitial is a limited-access format.
Properties
service Name
Name of the service that triggered the event.
slot
The slot that triggered the event.
উদাহরণ

জাভাস্ক্রিপ্ট

// 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

Extends Event
This event is fired when a game manual interstitial slot is ready to be shown to the user.

Note: Game manual interstitial is a limited-access format.
Properties
service Name
Name of the service that triggered the event.
slot
The slot that triggered the event.
পদ্ধতি
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 ( ) : void
Displays the game manual interstitial ad to the user.

googletag.events.ImpressionViewableEvent

Extends Event
This event is fired when an impression becomes viewable, according to the Active View criteria .
Properties
service Name
Name of the service that triggered the event.
slot
The slot that triggered the event.
উদাহরণ

জাভাস্ক্রিপ্ট

// 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

Extends Event
This event is fired when a rewarded ad slot is closed by the user. It may fire either before or after a reward has been granted. To determine whether a reward has been granted, use events.RewardedSlotGrantedEvent instead.
Properties
service Name
Name of the service that triggered the event.
slot
The slot that triggered the event.
উদাহরণ

জাভাস্ক্রিপ্ট

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

Extends Event
This event is fired when a reward is granted for viewing a rewarded ad . If the ad is closed before the criteria for granting a reward is met, this event will not fire.
Properties
payload
An object containing information about the reward that was granted.
service Name
Name of the service that triggered the event.
slot
The slot that triggered the event.
উদাহরণ

জাভাস্ক্রিপ্ট

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 : RewardedPayload
An object containing information about the reward that was granted.

googletag.events.RewardedSlotReadyEvent

Extends Event
This event is fired when a rewarded ad is ready to be displayed. The publisher is responsible for presenting the user an option to view the ad before displaying it.
Properties
service Name
Name of the service that triggered the event.
slot
The slot that triggered the event.
পদ্ধতি
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
Displays the rewarded ad. This method should not be called until the user has consented to view the ad.
রিটার্নস
boolean Whether the rewarded ad was successfully displayed.

googletag.events.RewardedSlotVideoCompletedEvent

Extends Event
This event is fired when a rewarded video ad has finished playing.
Properties
service Name
Name of the service that triggered the event.
slot
The slot that triggered the event.
উদাহরণ

জাভাস্ক্রিপ্ট

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

Extends Event
This event is fired when the creative's iframe fires its load event. When rendering rich media ads in sync rendering mode, no iframe is used so no SlotOnloadEvent will be fired.
Properties
service Name
Name of the service that triggered the event.
slot
The slot that triggered the event.
উদাহরণ

জাভাস্ক্রিপ্ট

// 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

Extends Event
This event is fired when the creative code is injected into a slot. This event will occur before the creative's resources are fetched, so the creative may not be visible yet. If you need to know when all creative resources for a slot have finished loading, consider the events.SlotOnloadEvent instead.
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.
size
Indicates the pixel size of the rendered creative.
slot
The slot that triggered the event.
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 : number
Advertiser ID of the rendered ad. Value is null for empty slots, backfill ads, and creatives rendered by services other than PubAdsService .

campaignId

campaignId : number
Campaign ID of the rendered ad. Value is null for empty slots, backfill ads, and creatives rendered by services other than PubAdsService .

companyIds

companyIds : number []
IDs of the companies that bid on the rendered backfill ad. Value is null for empty slots, reservation ads, and creatives rendered by services other than PubAdsService .

creativeId

creativeId : number
Creative ID of the rendered reservation ad. Value is null for empty slots, backfill ads, and creatives rendered by services other than PubAdsService .

creativeTemplateId

creativeTemplateId : number
Creative template ID of the rendered reservation ad. Value is null for empty slots, backfill ads, and creatives rendered by services other than PubAdsService .

isBackfill

isBackfill : boolean
Whether an ad was a backfill ad. Value is true if the ad was a backfill ad, false otherwise.

isEmpty

isEmpty : boolean
Whether an ad was returned for the slot. Value is true if no ad was returned, false otherwise.

labelIds

labelIds : number []

lineItemId

lineItemId : number
Line item ID of the rendered reservation ad. Value is null for empty slots, backfill ads, and creatives rendered by services other than PubAdsService .

responseIdentifier

responseIdentifier : string
The response identifier is a unique identifier for the ad response. This value can be used to identify and block the ad in the Ad Review Center (ARC) .

আকার

size : string | number []
Indicates the pixel size of the rendered creative. Example: [728, 90] . Value is null for empty ad slots.

slotContentChanged

slotContentChanged : boolean
Whether the slot content was changed with the rendered ad. Value is true if the content was changed, false otherwise.

sourceAgnosticCreativeId

sourceAgnosticCreativeId : number
Creative ID of the rendered reservation or backfill ad. Value is null if the ad is not a reservation or line item backfill, or the creative is rendered by services other than PubAdsService .

sourceAgnosticLineItemId

sourceAgnosticLineItemId : number
Line item ID of the rendered reservation or backfill ad. Value is null if the ad is not a reservation or line item backfill, or the creative is rendered by services other than PubAdsService .

yieldGroupIds

yieldGroupIds : number []
IDs of the yield groups for the rendered backfill ad. Value is null for empty slots, reservation ads, and creatives rendered by services other than PubAdsService .

googletag.events.SlotRequestedEvent

Extends Event
This event is fired when an ad has been requested for a particular slot.
Properties
service Name
Name of the service that triggered the event.
slot
The slot that triggered the event.
উদাহরণ

জাভাস্ক্রিপ্ট

// 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

Extends Event
This event is fired when an ad response has been received for a particular slot.
Properties
service Name
Name of the service that triggered the event.
slot
The slot that triggered the event.
উদাহরণ

জাভাস্ক্রিপ্ট

// 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

Extends Event
This event is fired whenever the on-screen percentage of an ad slot's area changes. The event is throttled and will not fire more often than once every 200ms.
Properties
in View Percentage
The percentage of the ad's area that is visible.
service Name
Name of the service that triggered the event.
slot
The slot that triggered the event.
উদাহরণ

জাভাস্ক্রিপ্ট

// 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 : number
The percentage of the ad's area that is visible. Value is a number between 0 and 100.

googletag.secureSignals

This is the namespace that GPT uses for managing secure signals.
ইন্টারফেস
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

Interface for returning a secure signal for a specific bidder or provider. One of id or networkCode must be provided, but not both.

googletag.secureSignals.BidderSignalProvider

Returns a secure signal for a specific bidder.

A bidder secure signal provider consists of 2 parts:

  1. A collector function, which returns a Promise that resolves to a secure signal.
  2. An id which identifies the bidder associated with the signal.
To return a secure signal for a publisher, use secureSignals.PublisherSignalProvider instead.
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 > )
A function which returns a Promise that resolves to a secure signal.

আইডি

id : string
A unique identifier for the collector associated with this secure signal, as registered in Google Ad Manager.

googletag.secureSignals.PublisherSignalProvider

Returns a secure signal for a specific publisher.

A publisher signal provider consists of 2 parts:

  1. A collector function, which returns a Promise that resolves to a secure signal.
  2. A networkCode which identifies the publisher associated with the signal.
To return a secure signal for a bidder, use secureSignals.BidderSignalProvider instead.
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 > )
A function which returns a Promise that resolves to a secure signal.

networkCode

networkCode : string
The network code (as seen in the ad unit path) for the publisher associated with this secure signal.

googletag.secureSignals.SecureSignalProvidersArray

An interface for managing secure signals.
পদ্ধতি
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 ( ) : void
Clears all signals for all collectors from cache.

Calling 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
Adds a new secureSignals.SecureSignalProvider to the signal provider array and begins the signal generation process.
Parameters
provider : SecureSignalProvider The secureSignals.SecureSignalProvider object to be added to the array.