How to protect your AdSense account from invalid clicks

In this post, we will discuss how to protect your AdSense account from invalid click activities by doing some minimal code changes in your web page.


 

Google AdSense is a popular advertising platform and is a great way to earn money online. Most bloggers prefer Google AdSense for monetizing their websites.

To have your AdSense account approved is a great deal in recent times but one must strictly adhere to AdSense program policies. If you fail to comply with these policies, your account might get banned. The first point in AdSense program policies clearly states that Publishers may not click their own ads or use any means to inflate impressions and/or clicks artificially, including manual methods.

Google monitors the clicks on its AdSense ads very closely. In order to prevent getting your account banned, you need to save your website from click bombings. There is no easy way to monitor the ad clicks on your website. In this post, we will show you how to protect your Google AdSense account from unusual invalid clicks.

 
The idea is actually very simple. When a user clicks on an AdSense ad for the first time, store a cookie/local storage on his machine with some expiration date. Now when the user visits another page in the same session or a new session, don’t serve him AdSense ads if that cookie if found on his machine.

 
To demonstrate, lets see some code:

1. Enclose all your AdSense ad codes inside a hidden div with ads class.

 
2. Then have below code inside the <head> section of your web page where your other scripts reside or include it just before closing </body> tag of your html page.

 

That’s it guys. Hope you have found this little piece of code helpful for protecting your AdSense account from invalid clicks.

 
Thanks for reading.

Please use our online compiler to post code in comments.
Like us? Please spread the word and help us grow. Happy coding 🙂
 


Leave a Reply

avatar
  Subscribe  
Notify of