pwRegisterLazyLoad Documentation
Lazy load adunits are called with the pwRegisterLazyLoad function.
pwRegisterLazyLoad(gptadslots['sample-adunit'],1, [10,0,10,0], 0, 800, 2);
The function has 6 parameters.
function pwRegisterLazyLoad(slot, loadType, rootMargin, threshold, mobileBreakpoint, mobileMultiple)
Field | Required |
---|---|
slot | Yes |
loadType | Yes |
rootMargin | No |
threshold | No |
mobileBreakpoint | No |
mobileMultiple | No |
- slot: The GAM Slot, which must be indexed by the DIV id in a page level array called gptadslots. i.e.
var gptadslots = gptadslots || []; gptadslots['divid'] = googletag.defineSlot(....
- loadType: 2 = viewable load with refresh, 1 = immediate load with refresh, 0 = immediate load
- Immediate load types are expected to be hooked into page level functionality for when to load
- Typical flow similar to:
if (customerLogicForAdLoad()) { pwRegisterLazyLoad([slot], 0); }
- rootMargin: An array based on the Intersection Observer root margin [10,0,10,0] 10 top, 0 right, 10 bottom, 0 left
- threshold: A number between 0.0 and 1.0 specifying a ratio of intersection area. Default is 0.0. The intersection observer documentation has more info.
- mobileBreakpoint: The page width at which to switch to mobile mode. This mode only effects the threshold multiple.
- mobileMultiple: integer that indicates the amount to multiply the threshold value by when the browser width is below the mobileBreakpoint value