Block 426 Low CPC Advertiser URLs in Adsense – Using VBScript to Remove Duplicate Domains


I think most bloggers have used google adsense to generate revenue from the traffic. But from time to time, you will notice that the CPC (Cost Per Click) is extremely low, only a few cents per click. There are many factors that influence the CPC. For example,  the website niche is one of the most dominant factor. The webhosting subject tends to attract more well-paid advs than dating related.  The geographical location is another important factor to consider. The advertising power from US or UK is considered to be better than the ones from Asian, i.e. India, China etc. If  you target the audiences from US or UK, then you probably will get a better CPC.

You can experiment to see which advertisers are more generous and which are less. So, suppose if you have a list of low CPC advertisers, then you can block them in adsense, so next time it won’t appear on your website(s).

Login to adsense, go to ‘Allow and Block Ads’, click ‘All My Websites’ (alternatively, you can specify the URLs for one of your website), and you can copy the URLS (maximum 500 allowed). The sad thing is that the adsense so far does not allow you to delete all (or many) entries at once. You have to unblock them one by one. So if you already blocked, e.g. 300 URLS, and you have another list from somewhere else and these two lists have some intersections (many domains are the same), so if you copy the content of the second list and click ‘block URLs’, the adsense will complain that the total number of URLS exceeds the maximum, which is 500.

1ff8d99df3cd3bd3c46d7767f9474a3f.jpg Block 426 Low CPC Advertiser URLs in Adsense - Using VBScript to Remove Duplicate Domains adsense beginner http VBA vbscript web programming webhosting windows scripting host wordpress

So, the following is a VBScript, that runs under windows if you enable WSH (Window Scripting Host), which is by default installed in almost every versions after windows XP.

Merge two lists into adsense_list.txt so that this file contains many duplicate domains. Save the following into adsense.vbs and double click, which will use cscript.exe to interpret the code. The script basically loads the list from adsense_list.txt and purge the duplicates, and a new file adsense_new.txt will be generated. It also filters domain names that start with www.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
' https://helloacm.com
Option Explicit
Dim dict, objFSO, listFile
 
Set dict = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set listFile = objFSO.OpenTextFile("adsense_list.txt")
 
Dim ns: ns = ""
Dim cur, xyz, j
 
Dim C_LRF: C_LRF = Chr(13) & Chr(10)
 
Do Until listFile.AtEndOfStream
    cur = Trim(listFile.ReadLine)
    xyz = Split(cur, ".")
    If (UBound(xyz) > 0) Then
        If (xyz(0) = "www") Then 'Remove www from domain
            cur = ""
            For j = 1 To UBound(xyz)
                cur = cur + xyz(j)
                If (UBound(xyz) <> j) Then
                    cur = cur & "."
                End If
            Next
        End If
        If Not dict.Exists(cur) Then ' If new entry, add
            dict.Add cur, cur
            ns = ns & cur & C_LRF
        End If
    End If
Loop
 
' Output the new list without duplicates
Dim f
Set f = objFSO.CreateTextFile("adsense_new.txt", true)
f.Write ns
f.Close
 
MsgBox "Done!"
' https://helloacm.com
Option Explicit
Dim dict, objFSO, listFile

Set dict = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set listFile = objFSO.OpenTextFile("adsense_list.txt")

Dim ns: ns = ""
Dim cur, xyz, j

Dim C_LRF: C_LRF = Chr(13) & Chr(10)

Do Until listFile.AtEndOfStream
	cur = Trim(listFile.ReadLine)
	xyz = Split(cur, ".")
	If (UBound(xyz) > 0) Then
		If (xyz(0) = "www") Then 'Remove www from domain
			cur = ""
			For j = 1 To UBound(xyz)
				cur = cur + xyz(j)
				If (UBound(xyz) <> j) Then
					cur = cur & "."
				End If
			Next
		End If
		If Not dict.Exists(cur) Then ' If new entry, add
			dict.Add cur, cur
			ns = ns & cur & C_LRF
		End If
	End If
Loop

' Output the new list without duplicates
Dim f
Set f = objFSO.CreateTextFile("adsense_new.txt", true)
f.Write ns
f.Close

MsgBox "Done!"

The 426 URLs to block can be found here.

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
678 words
Last Post: Webhosting Review: Management of VPS - The QuickHostUK Web Hosting
Next Post: Use PHP Script to Monitor Temperature and Uptime for Raspberry PI in the Browser

The Permanent URL is: Block 426 Low CPC Advertiser URLs in Adsense – Using VBScript to Remove Duplicate Domains

2 Comments

  1. IRCTC

Leave a Reply