Hello,

As I say in the issue title, Adblock, the Firefox extension, blocks ad 'cause the css class name.

Is it possible to rename the classes to another with a more common name ?

block-ad, advertisement, ... are not displayed

Thx.

CommentFileSizeAuthor
#17 ad.663742.patch7.97 KBraintonr

Comments

jeremy’s picture

Status: Active » Closed (works as designed)

Ad block is designed to block advertisements. The ad module displays advertisements.

floown’s picture

Status: Closed (works as designed) » Active

http://domain.com/sites/all/modules/ad/serve.php?q=1&t=0&u=node%2F5

The script is blocked too cause the name.

jeremy’s picture

Status: Active » Closed (works as designed)

As I said, the ad module is displaying advertisements, which Ad Block is designed to block. If we change the name, AdBlock only has to add a new rule to block that too -- it's a never ending war. You're welcome to modify the module all you want in your own tree, but I'm not interested in trying to work around ad block scripts.

floown’s picture

Status: Closed (works as designed) » Active

Ok Jeremy, sorry, I haven't see your message before post again.

I'll try to rename the module.

naught101’s picture

Jeremy: While I agree with you, that it's generally a bit unscrupulous to try to subvert adblock, there are plenty of legitimate reasons: the advertising module has potential uses for displaying links to other sites in a web-ring, for example.

Adblock mostly blocks on the url, I know this is more or less a won'tfix, but I was thinking, there'd probably a simple way to get around it - that is, add a path alias from
http://domain.com/dont/mention/ads?q=1&t=0&u=node%2F5
to
http://domain.com/sites/all/modules/ad/serve.php?q=1&t=0&u=node%2F5

I don't know if that can be done within drupal, because of the arguments after the query, but it would be pretty easy in .htaccess or higher up to add a re-write rule that would change the name.

I guess it would be good to give the option of setting your own css class names, or removing them all together

jmcoder’s picture

Title: adblock (Firefox extension) blocks ad 'cause the css class » Try an .htaccess rule

One feature ad could use is a custom keyword - it would then use this keyword in the css classes, and provide instructions to the user for creating an .htaccess rule for getting the custom url to map onto the path where the javascript is located. Adblock wouldn't be able to block it any more, since every Drupal site using the custom keyword feature would have different classnames & different virtual locations for the javascript.

naught101’s picture

Title: Try an .htaccess rule » adblock (Firefox extension) blocks ad 'cause the css class

issue title != comment title.

jmcoder’s picture

thanks naught101, I should have realized that.

raintonr’s picture

Title: adblock (Firefox extension) blocks ad 'cause the css class » Circumvent adblock (Firefox extension) and other ad filters/blockers
Category: bug » feature

IMHO we should try and work towards a way to circumvent adblock and filters of it's type.

Many public sites that would be built on Drupal do not charge subscriptions for their content and probably rely on advertising for some kind revenue towards hosting/development.

Looking at the adblock filters for one such page I see these items blocked:

/ad/serve (XML Request)
##.advertisement
##.block-ad
##.image-advertisement

I would propose these changes:

1. Use the menu system rather than referencing a PHP file directly to obfuscate the path of the XML Request, or create a symlink/copy in the files directory with obfuscated name.
2. Create dynamic CSS rules (using a PHP template file) that uses obfuscated CSS IDs and classes, store these classes in Drupal settings and use them in generation of blocks, etc.

Am happy to help and will have a go at these changes.

anonymous07’s picture

Subscribe

zeip’s picture

I'm using ad module also for banners that aren't really ads, but navigation to other parts of the site and/or other sites of the same topic. I would very much appreciate functionality to prevent blocking these banners at least to some extent.

Molot’s picture

I would love the other way of "solving" it. I'm OK with people blocking ads, at least in a way I know adblocks will always win on the long run and it's not worth the fight. But adblock detector showing customizable text info like "It seems your adblock cut out part of our navigation" would allow ppl to disable adblock on my site, or at least to refine it's rules so my ads would get hidden, but my navigation "ads" would not.
And I don't think adblock authors would explicitly fight that.

Kirk’s picture

I haven't looked into the techniques being used, but many sites (youtube for instance) seem to be able to recognize if you are running an ad blocker, then present you with a polite message to disable it for that site. I know that when I personally see these messages, I disable my adblocker for that site as they are asking me for permission to show me ads.

It is non-invasive and for a lot of sites, if you politely promise your users that you won't serve them obnoxious ads they are likely to white-list you.

Like i said, I'm not sure how they are doing this yet (js detection, if I were to guess) but it might be a good sub-module for ad.module.

Molot’s picture

@kclawes - most common technique I remember to see is to provide ad box with polite "disable ads", and if ads are enabled, then ad's javascript substitutes the box with image - if image is nonempty, that is. That way os notyfying user he is not seeing something I'd consider worthty. Restricting access to content is bad - if it would get popular, it would get disarmed in a day or two anyway.

mr.j’s picture

There is a fairly simple solution that works for me on both firefox and safari using the adblock plus easylist:

1. Rename the ad module directory to something inconspicous, i.e. not 'ad'. This stops the serve.php path from being blocked. If you have already sintalled the module then go back and re-save your modules admin screen and/or save the ad module configuration page so it recognises the new directory. You won't lose any settings (at least I didn't).

2. Override theme_ad_display, theme_ad_image_ad, and any other ad theme functions you need in your theme's template.php and remove the word 'advertisement' from the css classes that are generated. This stops adblock from hiding the divs surrounding the ads that are served.

raintonr’s picture

Re: #15.

Those are good suggestions, but it would be nice to have an 'out of the box' solution.

I have discovered that if one places a line like this in the ad_block module (view operation) then the class that some lists block is not present on the module:

    case 'view':
      $block['content'] = ad($delta, variable_get('ad_block_quantity_'. $delta, 1));
      $block['module'] = "anything-other-than-ad"; // <- add this.
      return $block;

One can also suggest using the Drupal menu system on an obfuscated URL (other than a direct call to serve.php) could circumvent the other mechanism.

As suggested, removal of any 'advertisement' classes can complete the look.

I will try and roll a patch for this sometime soon.

raintonr’s picture

StatusFileSize
new7.97 KB

Here's a patch that tries to obfuscate markup so ad blockers cannot see. Works well for me. Image and text ads working, others may need similar treatments.

Notes:

- There is a new option (obfuscate advertisement markup) on global settings - no changes should be seen unless that is enabled.
- In the future the menu path and block name should be changed regularly (in cron?) to avoid people creating rules to find them. I made these variable so all a cron would have to do is change those variables.
- Had to change the 'q=' (quantity) to 'a=' (amount) in the serve GET variables as 'q=' messes with core menu system.

Enjoy :)

raintonr’s picture

Status: Active » Needs review
kurapov’s picture

Attached patch file is working as advertised but switching "q" (quantity) variable for "a" (which is used for Ad ID) results in blocks ignoring "Number of ads" setting, i.e. only one ad per block is shown.

To fix this I edited adserve.inc (line 109)

// Ad ID is an integer.
    $variables->aid = isset($values['a']) ? (int)$values['a'] : 0;

to look like this:

// Ad ID is an integer.
    $variables->aid = isset($values['ai']) ? (int)$values['ai'] : 0;
dSero’s picture

Circumventing ad-blocking extensions is more complicated than ever, as it requires implementation both in the Drupal site and the ad server. Take a look at our module which reveals your ad-blocking percentages, and allows you to gain revenue by circumventing the ad-blocking extensions and presenting ads. It's brand new, and finally done. Enjoy.

http://drupal.org/project/dsero_anti_adblock_for_google_adsense

mustardman’s picture

In installed the dsero module and all you guys did was collect my stats but nobody ever got back to me to enable the ad blocking or redirecting.

So either you guys are being unscrupulous by tricking people into installing your module so you can collect stats or maybe you are just cherry picking the busier sites. You have lost my trust either way and I won't be installing your module again.

mustardman’s picture

This is what we use and it works well for us.

Your google adsense code here

    <script type="text/javascript"><!--
    (function(){var d=document;var i=d.getElementsByTagName('iframe');if(google_ad_client!=null||(window.getComputedStyle?d.defaultView.getComputedStyle(i[i.length-1],null).getPropertyValue('display'):i[i.length-1].currentStyle['display'])=='none'){d.body.innerHTML+='<style>html,body{margin:0;padding:0;height:100%}</style><center><tr><span style="color: Deepskyblue; padding:10px; margin-bottom:10px; text-shadow: Deepskyblue 1px 1px 10px; font-family: comic sans ms; padding:10px; margin-bottom:10px; font-size: 15pt;">Adblock Software Detected!!</color></span></span><br><br><span style="color: Deepskyblue; text-shadow: Deepskyblue 1px 1px 10px;"><span style="font-family: comic sans ms; font-size: 11pt;"> Hello Guest, You appear to be using adblocking software. Ads are a general way to cover server costs.<br> Please add this website to your whitelist.</color></span></center></tr>'}})()
    //--></script>

The nice thing about this is that our google ads are below our header/menus so those still work which is perfect for us. We have links going off to other sites and it also hints at what is on our site as sort of a teaser.

I haven't tried but I suppose you could just put this code in it's own block at the top of the page and perhaps the menus won't show either.

emcniece’s picture

Just weighing in - running Adblock Plus 1.3.4 for Chrome and I can see that it is adding the following CSS to my site pages:

.advert-box, .advert-content, .advert-horizontal, .advertColumn, .advertContainer, .advert_list, .advertisement, .advertisement-swimlane, .advertiser, .advertisment, .article_ad, .banner_728x90, .banner_ad, .block-ad, .block-google_admanager, .bottom-ad, .bottomAds, .bottom_ad_block, .category-ad, .contentAd{ display:none; }

.flash-advertisement, .footer-ad, .google-ad, .header-ad, .headerAd, .header_ad, .header_ad_center, .headerad, .headerads, .homead, .horizontal_ad, .image-advertisement, .innerad, .leaderboard-ad, .leftAd, .leftad, .marketing-ad, .mid_ad, .module-ad, .openx{ display:none; }

Tried overriding this in the theme css but it didn't work.

fizk’s picture

Status: Needs review » Closed (won't fix)

You're welcome to modify the module all you want in your own tree, but I'm not interested in trying to work around ad block scripts.

I agree with Jeremy and I'm closing this as won't fix.

michael_lessard_micles.biz’s picture

About mustardman's script just above here : I noticed the closing tag /color, which has no opening tag and I've never seen an HTML tag called color, so I'm guessing it's a tiny error in your script (has no impact).

The tr /tr, without a table, is probably also just something that fits well for your site, but might not for others. Just saying to help those applying that script.