Hi, I've been brainstorming features for my forums and how I should
layout ads. I came across many "banned from AdSense" topics, so I made
sure to read all the policies and guidelines well. As far as too many
clicks and click bots go, I don't want to get banned from AdSense
because someone out there has a problem. Whether it's someone who
doesn't like the forums, myself, staff member, user, or just a click
frenzy relative. I'm not sure if this is possible but I would like to
have Javascript/PHP filter limit a person from clicking ads on my
forums more than 3 times per day. After exceeding the limit, in the
future ads will no longer display for that IP (they won't be hidden,
they won't load at all). I would think it would already be a feature
to limit how many times a person's IP will count as a click for a
websites domain (or IP). Without altering the display or code of the
ad, is it still against the rules to do this?

Thank you in advance

Dani AI

Generated

As described, the goal is to prevent a single visitor from generating multiple advertiser clicks and risking an AdSense ban. Two important facts shape a safe solution: AdSense ad targets live inside cross-domain frames (so page scripts cannot reliably detect ad clicks), and publishers must not intercept, proxy or otherwise modify how ad clicks are delivered. That makes direct per-click counting (by rewriting ad links or routing clicks through a local click-tracker) both technically unreliable and likely against AdSense policy.

A policy-compliant alternative is to stop serving ad code to suspicious visitors instead of trying to capture clicks. Track simple signals the site can observe (logged-in account, session cookie, IP hash, unusually high impression rate) and, once a threshold is hit, omit the AdSense snippet for that key. This reduces exposure without altering the ad code itself. Responses from and touched on logging and other networks; the following expands a safe implementation approach.

Example schema and server-side flow (illustrative):

CREATE TABLE ad_usage (
key VARCHAR(64) NOT NULL,
day DATE NOT NULL,
impressions INT NOT NULL DEFAULT 0,
PRIMARY KEY (key,day)
);

$key = $user_id ? "u:{$user_id}" : "ip:".sha1($_SERVER['REMOTE_ADDR']);
$today = date('Y-m-d');
$row = db_fetch("SELECT impressions FROM ad_usage WHERE `key`=? AND day=?", [$key,$today]);

if (!$row) db_exec("INSERT INTO ad_usage (`key`,day,impressions) VALUES (?,?,0)", [$key,$today]);

if ($row['impressions'] < 3) {
  echo $adsense_html; // do NOT modify the AdSense code
  db_exec("UPDATE ad_usage SET impressions = impressions + 1 WHERE `key`=? AND day=?", [$key,$today]);
} else {
  echo "<div class='ad-placeholder'></div>";
}

Notes and cautions: prefer a combination of account/session + IP (IP-only blocks cause false positives on shared NATs). Keep logs for investigations and contact AdSense if invalid activity is suspected. Never proxy ad clicks or inject click-capture code into the ad iframe—those are the actions most likely to trigger enforcement.

Recommended Answers

All 3 Replies

You can atmost install adlogger.

Yeah thanks I got it all setup. Looks like that guy did exactly what I was thinking.

Of course... I'm improving it just a little bit.

Too bad people can still just use your AdSense code.

try adbrite and text links ads

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.