googletop with the /go/googletop Command

When someone clicks a Google ad, Google Ads (with auto-tagging on) adds a gad_campaignid parameter to the landing-page URL. /go/googletop searches the web server's access logs for requests that contain it, counts the visits per IP address, and shows who is clicking your ads. Repeated clicks from the same IP are often bots or click fraud, so the command can also list the repeat offenders and prepare a block list. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Who is clicking my ads?
/go/googletop

# IPs with 2 or more ad-click visits
/go/googletop max

Options

Argument Required Default Notes
max No — Lists only IPs with at least n visits.
n No 2 Minimum visits for max. A missing, 0, or non-numeric value becomes 2.
block No — Builds the block list. Uses a fixed minimum of 2 visits for the IP list.

With no arguments, the command runs in report mode.

Examples

# Full report
/go/googletop

# IPs with at least 5 ad-click visits
/go/googletop max 5

# Build the block list
/go/googletop block

# Block one reported IP
/go/block 203.0.113.10

Output

Report mode

IP VISITS COUNTRY CITY COMPANY
203.0.113.10 42 US Ashburn Example Hosting Inc
198.51.100.7 9 DE Frankfurt Example Cloud GmbH
------------------------------------------------
IPs: 2
------------------------------------------------

The server’s own IPv4, IPv6, and 127.0.0.1 are left out.

Max mode

203.0.113.10
198.51.100.7
------------------------------------------------
IPs: 2
------------------------------------------------

The footer is printed in this mode too. Remove it if you pass the list to another tool.

Block mode

Block mode prints, in order:

  1. A fixed set of large ranges: 52.0.0.0/11, 54.0.0.0/11, 34.0.0.0/11, 35.0.0.0/11, 20.0.0.0/11, 23.0.0.0/11, 159.203.0.0/16, 89.0.0.0/8, and 146.70.0.0/16.
  2. Ranges that contain two or more of the IPs found, such as 203.0.113.*.
  3. The output of /go/googletop max 2 (the IPs with 2 or more visits, with the footer).

The fixed ranges are only printed. They are not added to block.db.

Other messages

Message Meaning
Log Seconds: <n> between dashed lines The access log hasn’t been written to for more than 60 seconds, so the data may be stale. See Troubleshooting.
File /var/log/apache2/access.log not found. No access log was found (Debian/Ubuntu). The command stops.

Report and max modes end with exit status 0. Block mode always exits with 1.

Every run is logged to /var/log/go/googletop.log with a timestamp and the arguments used.

See the full reference at /go/googletop and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *