Tag Archives: WordPress

How to stop AdBlock killing your AdSense revenue on your website?

Many bloggers place AdSense ads on their blog sites to earn some bucks along with the funny blogging trip. However, it is not easy to make money from AdSense, one of the reason it more and more people are using web browser extension such as AdBlock to disable AdSense on their browsers.

It is difficult to say whether it is right to disable AdSense while browsing the free content of your website. Even you complain people who are using AdBlock, you have no way to remove the related extensions.

However, you do have the right to disable visitors viewing your website without showing AdSense ads. Here is the little trick, easy and simple to be implemented on your blog.

First, copy the snippet code below and paste it in to your one of theme file, say footer.php of WordPress theme, the position is at your choice, just before the tag: </body>. This piece of code is to determine whether the visitor is disabling the presence of AdSense on your blog site, if yes, then pop up the reminder asking the visitor disable AdBlock working on your site.

<script>(function(w,u){var d=w.document,z=typeof u;function g207(){function c(c,i){var e=d.createElement('i'),b=d.body,s=b.style,l=b.childNodes.length;if(typeof i!=z){e.setAttribute('id',i);s.margin=s.padding=0;s.height='100%';l=Math.floor(Math.random()*l)+1}e.innerHTML=c;b.insertBefore(e,b.childNodes[l-1])}function g(i,t){return !t?d.getElementById(i):d.getElementsByTagName(t)};function f(v){if(!g('g207')){c('<p>Please disable your ad blocker!<br/>This site is supported by the advertisement <br/> Please disable your ad blocker to support us!!! </p>','g207')}};(function(){var a=['Adrectangle','PageLeaderAd','ad-column','advertising2','divAdBox','mochila-column-right-ad-300x250-1','searchAdSenseBox','ad','ads','adsense'],l=a.length,i,s='',e;for(i=0;i<l;i++){if(!g(a[i])){s+='<a id="'+a[i]+'"></a>'}}c(s);l=a.length;for(i=0;i<l;i++){e=g(a[i]);if(e.offsetParent==null||(w.getComputedStyle?d.defaultView.getComputedStyle(e,null).getPropertyValue('display'):e.currentStyle.display)=='none'){return f('#'+a[i])}}}());(function(){var t=g(0,'img'),a=['/adaffiliate_','/adops/ad','/adsales/ad','/adsby.','/adtest.','/ajax/ads/ad','/controller/ads/ad','/pageads/ad','/weather/ads/ad','-728x90-'],i;if(typeof t[0]!=z&&typeof t[0].src!=z){i=new Image();i.onload=function(){this.onload=z;this.onerror=function(){f(this.src)};this.src=t[0].src+'#'+a.join('')};i.src=t[0].src}}());(function(){var o={'http://pagead2.googlesyndication.com/pagead/show_ads.js':'google_ad_client','http://js.adscale.de/getads.js':'adscale_slot_id','http://get.mirando.de/mirando.js':'adPlaceId'},S=g(0,'script'),l=S.length-1,n,r,i,v,s;d.write=null;for(i=l;i>=0;--i){s=S[i];if(typeof o[s.src]!=z){n=d.createElement('script');n.type='text/javascript';n.src=s.src;v=o[s.src];w[v]=u;r=S[0];n.onload=n.onreadystatechange=function(){if(typeof w[v]==z&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){n.onload=n.onreadystatechange=null;r.parentNode.removeChild(n);w[v]=null}};r.parentNode.insertBefore(n,r);setTimeout(function(){if(w[v]!==null){f(n.src)}},2000);break}}}())}if(d.addEventListener){w.addEventListener('load',g207,false)}else{w.attachEvent('onload',g207)}})(window);</script>

The second step is copying the css code below to style.css of your theme, which is to customize the display style of the warning text.

#g207{position:fixed!important;position:absolute;top:0;top:expression((t=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)+"px");left:0;width:100%;height:100%;background-color:#fff;opacity:0.9;filter:alpha(opacity=90);display:block}#g207 p{opacity:1;filter:none;font:bold 16px Verdana,Arial,sans-serif;text-align:center;margin:20% 0}#g207 p a,#g207 p i{font-size:12px}#g207 ~ *{display:none}

That is all. Next time, visitors who read your blog with AdBlock will see the warning messages as below:

Please disable your ad blocker.
This site is supported by the advertisement.
Please disable your ad blocker to support us!

Good luck to earn some revenue using AdSense when blogging.

The easiest way convert WordPress posts to Jekyll Markdown files

The so called static blog is getting increasingly popular on the internet. Probably people just need a place to blog, not necessarily a powerful WordPress platform which needs PHP, MYSQL database.

If you want to switch from WordPress to static blog site such as Jekyll, Octopress, a big problem would be how to convert your WordPress blog posts into MarkDown files that is the format required by most static blog engines.

Lots of tutorials tell bloggers that converting WordPress posts into Jekyll Markdown posts by GitHub command. This kind of coding style is actually complicated for average bloggers who never used git tool.

Here I share an easy method to do it, probably the easiest way ever to convert your WordPress posts to Jekyll Markdown files, no software, no git command, no pain, just install a plugin named “WordPress to Jekyll Exporter” (download link), then click the button “Export to Jekyll” under “Tools” menu of “WordPress administration panel”. The plugin will export all WordPress posts, pages, and options as YAML files parsable by Jekyll.

For guys who do not like Jekyll, the new and powerful static blog platform Farbox.com can also host your exported MarkDown blog posts. It is super easy to use and quite powerful. This link is an example of my blog hosted on Farbox using Jekyll files exported by the way I introduced in this blog post.

An effective way to block spam comments of WordPress blog

As bloggers, we welcome comments on our posts, sharing different viewpoints and adding more content. However, a headache is SPAM comments, which are typically generated by spam bots.

WordPress officially offers a plugin Akismet that can reduces spam comments to a great extent. I still got hundreds of comments labelled as spam by Akismet plugin. I would be happier if there is a method to block spam comments even before them being left on the blog, which will reduce the loading work of web hosting server, and also keep the MYSQL database clean.

Finally, I found an effective way. Several weeks ago, I started to use Incapsula as my CDN provider to accelerate the speed of my blog worldwide. To my surprise, the using of Incapsula greatly avoided the number of spam comments, there were almost no items even in the spam comments category as it was when I use Akismet plugin.

I checked the trick behind Incapsula, finding the CDN provider offers a protective layer against spam comment bots. Almost all of the spam bots are blocked before they want to access the blog where to submit the spam comments.

Incapsula is a very good CND provider. It has a free plan for small websites. You can have it a try to speed up the performance of your website worldwide, meanwhile, say goodbye to spam comments.