Forum Moderators: martinibuster
I have seen posts that wish detailed AdSense reports such as site level or page level stats.
Currently, we are working on a script to track AdSense impressions and clicks. The script lets you track the stats of sites, pages, referrers, color combinations, ad formats, visitor countries, paid or alternate ads displayed etc.
To remove questions, it conforms to Google TOC completely. No change to AdSense code, no interference.
I want to know your opinions on tracking AdSense independently. Do you personally want to use such a script? What features would you expect?
Thanks
Also, depending on what JS script you're using I want to remind everyone that the scripts have the potential to record actions as clicks when they aren't clicks. I'm talking about right-clicking, dragging without releasing the mouse button, etc. that some of us mentioned early in this thread. I'm not saying that someone came and right-clicked an ad 37 times in one minute, but it's possible and only Google would have the data to verify or eliminate.
Even clicking 37 times, by itself, is probably no big deal. The fact that it was observed it within a couple of days of a relatively small number of people starting to track their clicks suggests that it must occur frequently.
- logging (default, saves output of javascript)
- reporting (creates HTML table of data)
(see comments in code for how to specify mode)
To use the script follow these steps-
1. copy and paste this script to a text editor and save the file as 'tracklix.cgi'
2. change value "YOURTRACKINGSCRIPT" to in the JavaScript to-
/cgi-bin/tracklix.cgi?
(or wherever you keep your CGI scripts)
3. upload the file to your CGI bin (FTP/ASCII mode)
4. CHMOD 755 the file (-rwxr-xr-x)
Next ad click will create a file "tracklix.db" in the same directory as the script (you can change the path once you get to know the script).
NOTE: This file creates a simple ASCII 'pipe delimited' file, which will grow quickly... it should probably have some method for daily archiving, (and a million other features)... but I gotta go earn a living... <grin>
#!/usr/local/bin/perl -w
#
# ===========================================
# TRACKLIX.CGI (c)rmh 2004
# ===========================================
# *** FREEWARE *** Released to public.
#
# Set some parameters (if you want to).
#
# Data is displayed on alternating row
# background colors pick two new ones
# if you like.
#
$DATA_bgcolor_1 = "#F4F4F4";
$DATA_bgcolor_2 = "#E0F4F4";
#
# data is output to ASCII (pipe delimited)
# database file. Next line puts it where
# you want it.
#
$datafile = "tracklix.db";
#
# if your date command is different, change this too.
#
$dateCmd = '/bin/date';
#
# with nothing but the parameters from the JavaScript,
# this Perl code wil just write it to disk, BUT...
# call this script with '?f_mode=RPT1' ie-
#
# /cgi-bin/tracklix.cgi?f_mode=RPT1
#
# and it prints a report! (everything in the log)
# this is for testing and then modify the code to
# use whatever DB you're comfortable with that
# can handle the share / lock needs, etc..
#
use CGI;
#
$query = new CGI;
#
$f_ref = ($query->param("ref"));
$f_url = ($query->param("url"));
$f_w = ($query->param("w"));
$f_h = ($query->param("h"));
$f_f = ($query->param("f"));
$f_cb = ($query->param("cb"));
$f_cbg = ($query->param("cbg"));
$f_cl = ($query->param("cl"));
$f_cu = ($query->param("cu"));
$f_ct = ($query->param("ct"));
#
$f_mode = uc($query->param("f_mode"));
#
if ($f_mode eq "") {
#
chop ($DateStamp = `$dateCmd +"%Y%m%d"`);
$rec = join ( "\¦", $DateStamp, $f_ref, $f_url, $f_w, $f_h, $f_f, $f_cb, $f_cbg, $f_cl, $f_cu, $f_ct );
open (RAW,">>$datafile");
printf (RAW "$rec\n");
close (RAW);
} elsif ($f_mode eq "RPT1") { # report #1, list all
#
print "Content-type: text/html\n\n";
print "<html>\n\n<head>\n<title>Ad / Click Tracking Report</title>\n</head>\n\n<body>\n";
$flipper = "0";
print "<TABLE border=\"1\" cellspacing=\"0\"cellpadding=\"2\" width=\"100%\">\n";
open (DAT,"$datafile") ;
seek (DAT,0,0);
while ($rec = <DAT>) {
@rec = split (/\¦/,$rec);
if ($flipper eq "0") { $bg = $DATA_bgcolor_1; $flipper = "1";} else {$bg = $DATA_bgcolor_2;$flipper = "0";}
print "<TR bgcolor=\"$bg\"><TD>$rec[0]</TD><TD>$rec[1]</TD><TD>$rec[2]</TD><TD>$rec[3]</TD><TD>$rec[4]</TD><TD>$rec[5]</TD><TD>$rec[6]</TD><TD>$rec[7]</TD><TD>$rec[8]</TD><TD>$rec[9]</TD></TR>\n";
}
print "</TABLE>\n";
}
#
print "</body>\n";
print "</html>\n";
#
exit;
#
# ==================
# end of script
# ==================
print "</TABLE>\n";
} <----- move this
#
print "</body>\n";
print "</html>\n";
#
<----- to here
#
exit;
#
# ==================
# end of script
# ==================
as.asp
<%
'::::::::::::::::::::
':::: Record Visit in Log File':: Open Log File
dim aslg, logFile8
set aslg=createObject("scripting.FileSystemObject")
set asLog=aslg.openTextFile(server.mappath("NAME-OF-YOUR-FILE.txt"),8,True)':: Record Date and Time of Visit
asLog.write date & "," & time & chr(9)':: Record IP Address of Visitor
asLog.write Request.ServerVariables("Remote_Addr") & chr(9)':: Record Users OS Type
if Instr(Request.ServerVariables("HTTP_USER_AGENT"), "Mac") then
asLog.write "Mac User" & chr(9)
elseif Instr(Request.ServerVariables("HTTP_USER_AGENT"), "Win") then
asLog.write "Windows" & chr(9)
elseif Instr(Request.ServerVariables("HTTP_USER_AGENT"), "Linux") then
asLog.write "Linux" & chr(9)
else
asLog.write "Other" & chr(9)
end if':: Record Browser Type
asLog.write Request.ServerVariables("HTTP_USER_AGENT") & chr(9)':: Record Referrer for Visit
if Request.ServerVariables("HTTP_REFERER") = "" then
asLog.write "Not Refered" & chr(9)
else
asLog.write Request.ServerVariables("HTTP_REFERER") & chr(9)
end if':: Record This Page Name
asLog.write Request.Querystring("ref") & chr(9)':: Record The Ad Destination
asLog.write Request.Querystring("url")':: End line for this Record
asLog.write vbcrlf':: Close Log File
asLog.close
set asLog=nothing
set aslg=nothing':::: Done Recording Visit
'::::::::::::::::::::
%>
It is a fairly simple format to follow incase you want to add more details to your log, this is just what I wanted to begin with.
I had the same problem with that vbs script!
I've emaild monitorman about this, and he told me to change line 157 to:
TheCurrentDate = Day(AdjustedTime) & ", " & Year(AdjustedTime)
After I changed it, it fixed that error, but now I'm getting a new error at line: 212
Still trying to fix that!
Noel
However some webmasters including myself have notice multiple clicks from the same IP on the same ad with in a matter of seconds. I managed to repeat the problem by clicking on an ad (first click), then hitting the back button where a second click was logged. It seems that if the status bar contains the relevant text then a click is logged. Is their any work around for this? Maybe clear the status bar on page load or something? I don't know Javascript so I have no idea...
var lastStatus = '';function aslog(e) {
window.focus();
if (window.status && (window.status!= lastStatus))
{
lastStatus = window.status;
var bug = new Image();
bug.src = 'YOURSCRIPT?ref=' + escape(document.location.href) +
'&url=' + escape(window.status);
}
}
Well, if you are interested, our solution is now ready on the web. You can reach it through my profile (I think) and download the free evaluation copy.
We prefer contacting us directly if you need to ask or tell something about the script, instead of posting here.
Thank you all.
It turns out that javascript generated is not remotely compliant.
Line 120, column 67: cannot generate system identifier for general entity "SectionID" /tracker/tracker.php?SiteID=5&SectionID=1&SetID=3&page=' + escape(docu
^
Line 120, column 67: general entity "SectionID" not defined and no default entity (explain...). /tracker/tracker.php?SiteID=5&SectionID=1&SetID=3&page=' + escape(docu
^
Line 120, column 76: reference not terminated by REFC delimiter /tracker.php?SiteID=5&SectionID=1&SetID=3&page=' + escape(document.loca
And on an on. How do I fix this? Is it just a matter of escaping the & or is something else the problem. My pages were XHTML 1.0 compliant before I added this code, and I'd like to keep them that way.
Aaron
Thanks
Aaron
I also noticed that information is being sent back to your own server each time I use this script.
I am no programmer but I would like to know what info is being asked for and why you would want this information.
Is this a case of tracking the trackers?
I have now taken this code off my server and happy to use Dans free tracking program.
Whilst the google tracking feature is a good start, I do like to know in real time what is happening and not wait 8, 12, 24 hours to see what is working and what is not. The guessing of which ad is also brillient.
Thanks Dan!
If anyone has a different script, please let me know.
R