Advertisement
clickio

JS code to remove ad units from specific pages

Dec 16th, 2020 (edited)
1,066
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function(w){
  2.     let urls    = [ // URLs array to remove ad units from
  3.         '/estaticas/que-jugador-del-lugo-ha-sido-tu-favorito.html'
  4.     ];
  5.     let adUnits = [ // Ad units to remove from URLs in previous array
  6.         '_663008',
  7.         '_660209'
  8.     ];
  9.     function checkUrl(url){
  10.         return urls.some(function(urls) {
  11.             return url.indexOf(urls) !== -1;
  12.         });
  13.     }
  14.     if(checkUrl(document.location.href))
  15.     {
  16.         try {
  17.            
  18.             Array.from(adUnits).forEach(function(adUnit) {
  19.                 delete w.__lxGr__[adUnit];
  20.             });
  21.         } catch (e) {
  22.             console.log("NO AD UNIT!");
  23.         }
  24.     }
  25. })(window);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement