Featured post

How to make PIPUDI from any tree leaf whistle - પીપડાના પાનની પીપુડી, ગાજરાની પીપુડી

Image
How to make PIPUDI from any tree leaf whistle - પીપડાના પાનની પીપુડી, ગાજરાની પીપુડી   Make PIPUDI from pipal tree leaf with magic voice, a simple game to teach your child while free or take a tour to village , we was played a lot at farm and make PIPUDI with different sound practice tree leaf-whistle Get more videos here: Tailorbird nest on okra https://www.youtube.com/watch?v=TbVcY... અથાણા માટે કઇળા - Kair (ker) for Pickle - अचार वाले केर https://www.youtube.com/watch?v=WFNSf... Papaya tree | aisa papaya ka pedh kabhi nahi dekha hain ? https://www.youtube.com/watch?v=RtXt0... Trip to Manali | Solang Valley | rohtang pass | snow point - Manali Diaries Ep. 02 https://www.youtube.com/watch?v=nMZkr... Lockdown Days and Duty - MGNREGA YOJANA AND THE LACK - rural area https://www.youtube.com/watch?v=cYnKN... A journey to the Moksh - Taranga hill - મોક્ષ દ્વાર તારંગાની ઘાટીમા - Jain Tirth - Gujarat https://www.youtube.com/watch?v=PpeMA... SIDDHASHILA - TARANGA HILL - GUJARA...

Ad Blocker for Google Adsense JavaScript for mobile application

Advertisements are very important for any post published in internet. This is what decides the person’s revenue. But, recently ad blocker system is killing revenue of the publisher because of which it also effects the creativity of that person. Today, I am providing a simple new solution for those depressed and effected persons of ad blocking system. Here is a simple javascript to be included along with your website code to either hide the content of your website or show a pop-up or alert message to remove the viewers ad block plugin. Any blogger or any website management can use this code to improve your revenue of your website. This code is mainly designed for Google Adsense.



Google Adsense
You have to include onerror event to the script tag, this will trigger adBlockFunction() Javascript function.

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" onerror="adBlockFunction();"></script>
<ins class="adsbygoogle"
style="display:inline-block;width:300px;height:600px"
data-ad-client="ca-pub-XXXXXXXXXXXXX"
data-ad-slot="XXXXXXX"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>


Ad Blocker Function
This contains very simple JavaScript code, this will replace article content part with ad blocker message. If you are Google Blogger user don't change the class name post-body-n. This function helps you to track ad blocker usesr count with Google Analytics.
<script>
function adBlockFunction()
{
// Google Analytics Tracking 
setTimeout(function() {
ga('send', 'event', 'Blocker', 'click','Blocker');
},2000);
// Google Analytics End

// Website Users
document.getElementById('contentDivName').innerHTML = 'Please disable your ad blocker for yourwebitename.com';

// Google Blogger Users
document.getElementsByClassName('post-body-n')[0].innerHTML = 'Please disable your ad blocker for yourwebitename.com';
}
</script>
Sample Website HTML Code

//HTML Code
<div id="container">

<div id="contentDivName">

Article Content Part // This will replace with ad blocker message
</div>

<div id="sidebar">

Google Adsense Code
</div>

</div>

Ad Blocker Function for Alert Bar like 9lessons.info
<script>
function adBlockFunction()
{
// Google Analytics Tracking 
setTimeout(function() {
ga('send', 'event', 'Blocker', 'click','Blocker');
},2000);
// Google Analytics End

document.getElementById('ab-message').style.display = 'block';
}
</script>

HTML Code
Include the ad-message div tag after the tag <body>
<style>
#ad-message{
text-align: center;
background-color: #E23C3C; color: #ffffff;
font-weight: bold; font-family: Arial;
border-bottom: solid 1px #333333;
}
</style>

//HTML Code
<body>
<div id='ad-message' style='display: none;'>
Please disable your ad blocker for yourwebitename.com
</div>
.....
.....
 

Comments

Home Ads

Popular posts from this blog

Rajkot District Gram Panchayat Sarpanch and Talati Mantri Contact Details 2017

Which pen should I use to mark answers on an OMR sheet ? and how to do it

harappa or Haddappa Culture and Sanskruti in Gujarat