Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script async='async' src='https://www.googletagservices.com/tag/js/gpt.js'></script>
- <script>
- var googletag = googletag || {};
- googletag.cmd = googletag.cmd || [];
- </script>
- <script>
- googletag.cmd.push(function() {
- googletag.pubads().enableSingleRequest();
- googletag.pubads().setTargeting('URL', window.location.pathname);
- googletag.pubads().disableInitialLoad();
- googletag.pubads().enableLazyLoad({
- fetchMarginPercent: 100, // Fetch slots within 5 viewports.
- renderMarginPercent: 100, // Render slots within 2 viewports.
- mobileScaling: 2.0 // Double the above values on mobile.
- });
- googletag.enableServices();
- });
- var aiNextSlotId = 1;
- function aiGenerateNextSlotName() {
- var id = aiNextSlotId ++;
- return 'ai-slot-' + id;
- }
- function aiLoadBlock(adUnitPath, size, unit) {
- var slotName = aiGenerateNextSlotName();
- document.getElementById ("ai-block").id = slotName;
- googletag.cmd.push(function() {
- //console.log(unit);
- if (unit == "LDBD"){
- //console.log(unit);
- var mapping = googletag.sizeMapping().
- addSize([992, 0], [728, 90]). //desktop
- addSize([768, 0], [728, 90]). //tablet
- addSize([0, 0], [320, 50]). //other
- build();
- }
- else if (unit == "TPBT"){
- //console.log(unit);
- var mapping = googletag.sizeMapping().
- addSize([992, 0], [[970, 90], [970, 250], [728, 90]]). //desktop
- addSize([768, 0], [728, 90]). //tablet
- addSize([0, 0], [[320,50],[300,100]]). //other
- build();
- }
- else if (unit == "DYNA"){
- //console.log(unit);
- var mapping = googletag.sizeMapping().
- addSize([992, 0], [[728,90],[300,250],[336,280],[468,60], [300,600],[320,50],[300,100]]). //desktop
- addSize([768, 0], [[728,90],[300,250],[336,280],[468,60], [300,600],[320,50],[300,100]]). //tablet
- addSize([0, 0], [[300,250],[336,280], [300,600],[320,50],[300,100]]). //other
- build();
- }
- else if (unit == "SIDE"){
- //console.log(unit);
- var mapping = googletag.sizeMapping().
- addSize([0, 0], [[300,250],[336,280],[300,600],[320,50],[300,100]]).
- build();
- }
- else if (unit == "FOOT"){
- //console.log(unit);
- var mapping = googletag.sizeMapping().
- addSize([0, 0], [300,250]).
- build();
- }
- var slot = googletag.defineSlot(adUnitPath, size, slotName).
- defineSizeMapping(mapping).
- addService(googletag.pubads());
- googletag.display(slotName);
- googletag.pubads().refresh([slot]);
- });
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement