📑 Quick Navigation
Invalid clicks are a serious problem that can affect any website owner. Google AdSense may penalize your account due to invalid traffic, which can lead to temporary ad serving restrictions or even permanent account suspension in severe cases.
If you want to control how visitors interact with your AdSense ads, you need a reliable protection script. In this guide, we'll show you how to install and configure an AdSense Anti-Fake Clicks Protection Script specifically designed for Blogger blogs.
What is the AdSense Anti-Fake Clicks Protection Script?
The AdSense Anti-Fake Clicks Protection Script is a tool that helps you control the number of clicks allowed per visitor within a specific time period that you can customize according to your needs.
Key Features
- Set Maximum Clicks: Define the maximum number of clicks allowed per visitor per day
- Time-Based Reset: Configure how long before the click counter resets (in seconds)
- Two Protection Modes:
- Disable Clicks: Ads remain visible but become unclickable
- Hide Ads: Completely hide ads instead of just disabling clicks
For example, let's say you set the maximum clicks to 3 per visitor per day. When a visitor clicks on their third ad, they won't be able to click on any more ads because the script acts as a barrier that prevents additional clicks. The ads remain visible, but clicking becomes impossible.
Whether you choose to hide ads or disable click functionality, this mechanism helps you control visitors who intentionally click on ads repeatedly to harm your account. By setting a maximum click limit per visitor using this protection script, you can manage visitor activity and protect your AdSense account from invalid traffic.
How Does the Protection Script Work?
The AdSense Anti-Fake Clicks Protection Script works by counting the number of clicks each visitor makes and storing this information in their browser using Cookies.
Understanding the Cookie System
When a visitor clicks on an ad, the script stores a cookie in their browser with the click count. This count persists even if they refresh the page or close and reopen their browser (until the timeout period expires).
Let's assume the maximum click limit you set is 3 clicks. When the visitor clicks on their third ad, the maxClick value is reached. From this point on, the visitor won't be able to click on any ads for a specified period of time.
The visitor can still see the ads, but when they try to click, nothing happens because the script applies pointer-events: none to the ad elements. Alternatively, if you prefer to hide ads instead of just disabling clicks, you can change the setting to display: none in the script configuration.
How to Install the AdSense Protection Script
Follow these steps carefully to install the script on your Blogger blog:
Go to Blogger.com and sign in to your account.
In the left sidebar, click on "Theme" option.
Click the dropdown arrow next to "Customize", then select "Edit HTML".
Search for </head> tag and paste the following code just above it:
<script>
/*<![CDATA[*/
/* Cookie Functions */
const Cookie = {
get: (e) => {
e = document.cookie.match(new RegExp("(?:^|; )" + e.replace(/([.$?*|{}()[\]\\\/+^])/g, "$1") + "=([^;]*)"));
return e ? decodeURIComponent(e[1]) : void 0
},
set: (e, n, o = {}) => {
o = { path: "/", ...o };
o.expires instanceof Date && (o.expires = o.expires.toUTCString());
let c = unescape(encodeURIComponent(e)) + "=" + unescape(encodeURIComponent(n));
for (var t in o) {
c += "; " + t;
var a = o[t];
!0 !== a && (c += "=" + a)
}
document.cookie = c
},
rem: (e) => {
Cookie.set(e, "", { "max-age": -1 })
}
};
/* AdSense Protection Script Configuration */
const antiBombSet = {
timeOut: 3600, /* Time in seconds before ads reappear (3600 = 1 hour) */
maxClick: 3, /* Maximum clicks allowed per visitor (change this number) */
cookieKey: "MAX_CLICKED", /* Cookie key name - DO NOT CHANGE */
adsSelectors: "ins.adsbygoogle", /* Ad selector - DO NOT CHANGE */
iframeSelectors: "ins.adsbygoogle iframe", /* iframe selector - DO NOT CHANGE */
callback: () => {
if (antiBombSet.executed === undefined) {
antiBombSet.executed = !0;
/* Change 'pointer-events:none' to 'display:none' to HIDE ads instead of disabling clicks */
if (document.getElementById("mxAds_stl") == null) {
var stl = document.createElement("style");
stl.id = "mxAds_stl";
stl.innerHTML = (antiBombSet.adsSelectors || ".adsbygoogle") + "{pointer-events:none}";
document.head.appendChild(stl);
}
/* Optional: Show warning message in console when max clicks reached */
/* console.warn("Maximum ad clicks reached. Please avoid clicking ads repeatedly."); */
}
}
};
if (Cookie.get(antiBombSet.cookieKey || "ADS_CLICK") != undefined &&
parseInt(Cookie.get(antiBombSet.cookieKey || "ADS_CLICK")) >= (antiBombSet.maxClick || 3)) {
antiBombSet.callback()
};
/*]]>*/
</script>
Search for </body> tag (usually at the end of the template) and paste this code just above it:
<script>
/*<![CDATA[*/
!function() {
function n(e, o) {
return null != (e = Cookie.get(e)) && parseInt(e) >= o
}
var l = antiBombSet.cookieKey || "ADS_CLICK",
e = antiBombSet.adsSelectors || ".adsbygoogle",
i = antiBombSet.timeOut || 7200,
c = antiBombSet.maxClick || 3;
0 < document.querySelectorAll(e).length && document.querySelectorAll(e).forEach(e => {
e.addEventListener("click", function() {
var e, o;
n(l, c) ? antiBombSet.callback() : (e = l, null != (o = Cookie.get(e)) ?
(o = parseInt(o) + 1, Cookie.set(e, o.toString(), {
secure: !0,
"max-age": i
})) : Cookie.set(e, "1", {
secure: !0,
"max-age": i
}))
})
});
window.addEventListener("blur", function() {
n(l, c) && antiBombSet.callback();
for (var e, o, t = document.querySelectorAll(antiBombSet.iframeSelectors || ".adsbygoogle iframe"),
a = 0; a < t.length; a++)
document.activeElement == t[a] && (n(l, c) ? antiBombSet.callback() :
(e = l, null != (o = Cookie.get(e)) ? (o = parseInt(o) + 1, Cookie.set(e, o.toString(), {
secure: !0,
"max-age": i
})) : Cookie.set(e, "1", {
secure: !0,
"max-age": i
})))
})
}();
/*]]>*/
</script>
Click the "Save" button to apply the changes to your blog.
Configuration Settings
How to Set the Maximum Click Limit
To change the maximum number of clicks allowed, search for maxClick in both scripts. You'll find it in three places. Change the number next to it wherever you find it to your desired limit.
| Setting | Description | Default Value |
|---|---|---|
| maxClick | Maximum clicks allowed per visitor | 3 |
| timeOut | Time in seconds before counter resets | 3600 (1 hour) |
| cookieKey | Cookie identifier (don't change) | "MAX_CLICKED" |
Recommended Settings
- Low traffic blogs: maxClick = 5, timeOut = 86400 (24 hours)
- Medium traffic blogs: maxClick = 3, timeOut = 3600 (1 hour)
- High traffic blogs: maxClick = 2, timeOut = 1800 (30 minutes)
Change Protection Mode
By default, the script uses pointer-events: none which keeps ads visible but makes them unclickable. To completely hide ads instead, change this line in the first script:
// FROM (disable clicks only):
stl.innerHTML = (antiBombSet.adsSelectors || ".adsbygoogle") + "{pointer-events:none}";
// TO (hide ads completely):
stl.innerHTML = (antiBombSet.adsSelectors || ".adsbygoogle") + "{display:none}";
Testing the Protection Script
Important: Google AdSense policy strictly prohibits publishers from clicking on their own ads. However, there is a safe way to test if the script is working on your site.
Safe Testing Method
- Go to your Blogger dashboard and create a new page
- Using the pencil icon in the top right, switch from "Compose" mode to "HTML View"
- Paste the following test code and publish the page:
<ins class="adsbygoogle">
<a href="https://google.com">
<img alt="Test Ad" src="https://via.placeholder.com/728x90/4285f4/ffffff?text=Test+Ad" />
</a>
</ins>
The code above uses the same class identifier as AdSense ads (ins.adsbygoogle). After publishing the test page:
- Open the page in your browser
- Click on the test image 3 times (or your configured maxClick limit)
- On the 4th attempt, you should NOT be able to click or be redirected
✅ Success Indicator
If clicking stops working after reaching your configured limit, the AdSense Anti-Fake Clicks Protection Script is working correctly on your website!
What to Do If You Detect Suspicious Activity?
It's important for every AdSense publisher to know that you are responsible for monitoring the quality and quantity of your traffic. If you notice any suspicious activity, unusual clicks, or believe clicks are intentional from malicious users, we recommend using Google's Invalid Clicks Contact Form to report the issue to AdSense support.
Reporting invalid activity helps prevent artificial inflation of your earnings and protects your account from suspension.
How to Fill Out the Invalid Clicks Form
| Field | What to Enter |
|---|---|
| Full Name | Your name as it appears in your AdSense account |
| The email address associated with your AdSense account | |
| Publisher ID | Your AdSense publisher ID (ca-pub-xxxxxxxxxxx) - found in your account URL |
| Website URL | The URL of your site receiving invalid traffic (e.g., https://www.example.com/) |
| Subject | Select "Report suspicious activity in my account" for invalid clicks |
| Date/Time | The date(s) when invalid traffic occurred (e.g., November 27, 2024, 8:00 PM) |
| Description | Explain why you believe the traffic is invalid. Include data from Google Analytics showing suspicious IP addresses or countries |
| IP Addresses | List any suspicious IP addresses or country names |
Additional Protection Tips
🛡️ Layered Protection Strategy
- Use this protection script to limit clicks per visitor
- Monitor Analytics regularly for unusual traffic patterns
- Enable AdSense email alerts for policy violations
- Block suspicious IP addresses using .htaccess or firewall
- Use Cloudflare to filter bot traffic
- Never click your own ads - not even to test
⚠️ Important Disclaimer
This script is provided as-is for educational purposes. While it can help reduce invalid clicks, it does not guarantee protection against all forms of click fraud. Always follow Google AdSense Program Policies and monitor your account regularly. The author is not responsible for any AdSense account issues.
Conclusion
The AdSense Anti-Fake Clicks Protection Script is an effective tool for Blogger users who want to protect their AdSense accounts from invalid clicks and fake traffic. By limiting the number of clicks per visitor and using cookie-based tracking, you can significantly reduce the risk of accidental or malicious click fraud.
Remember that this script is just one layer of protection. Combine it with regular monitoring, proper traffic analysis, and adherence to AdSense policies for the best results.
CONCLUSION
In this article, I shared with you 🛡️ AdSense Anti-Fake Clicks Protection Script. I hope you found it helpful and informative. Please share it with your friends and follow our blog for more updates.
If you face any problems in demo, download, or have any questions, feel free to ask me in the comments section or join our Telegram Channel to get the latest posts and updates daily.
Note: All posts shared here are only for educational and informational purposes. We respect the rights of original creators. If you are the content owner and have any concerns, please contact us for review.
©Copyright: niadzgn.blogspot.com™
