日期:2014-05-18  浏览次数:20490 次

关于google adsense统计的第三方插件的问题
如何做到点击的google的广告,但也能统计到你点了哪个广告网站的信息的..比如这广告网站的网址等等..........

------解决方案--------------------
把下面代码存为adLog.asp(分两部分)


<%@ CODEPAGE=65001 %>
<%
'///////////////////////////////////////////////////////////////////////////////
'// Google Adsense Click Logger
'// 作 者: duduwolf
'// 版权所有: 嘟嘟老窝(http://www.duduwolf.com/)
'// 技术支持: duduwolf@hotmail.com
'///////////////////////////////////////////////////////////////////////////////
%>
<% Option Explicit %>
<% On Error Resume Next %>
<% Response.Charset=WebCharset %>
<% Response.Buffer=True %>
<%
'=====定义全局变量=====

Const TextFile = "adLogDemo.txt " '保存点击数据的text文件,是相对路径,可以修改
Const AccessPassword = " " '查看点击时的访问密码,可以自行设定,如果无需身份认证,请将AccessPassword值改为 " "即可
Const SessionName = "google_ad_logger_demo " 'Session名称,用来保存访问密码到指定Session中
Const WebCharset = "utf-8 " '网站的编码类型,如果是GB-2312,请自行修改
Const UserName = "username " '用户名cookie,如果你的站没有用户cookie,就不用管了

'======================

Session.TimeOut = 30

Dim SendUrl, Url
SendUrl = "http:// " & Request.ServerVariables( "SERVER_NAME ") & Request.ServerVariables( "URL ")

Url = Request.ServerVariables( "URL ")

'=====接收客户端AJAX传过来的点击log数据保存到text中
If Request.ServerVariables( "REQUEST_METHOD ") = "POST " Then
Dim fso, f
If Request.QueryString( "act ") = "editLog " Then
Call SaveTxtFile()
Response.Redirect Url & "?act=editLog "
ElseIf Request.QueryString( "act ") = "login " Then
If Request.Form( "pwd ") = AccessPassword Then
Session(SessionName) = AccessPassword
Else
Response.Clear
End If
Response.Redirect Url & "?act=editLog "
Else
Set fso = Server.CreateObject( "Scripting.FileSystemObject ")
Set f = fso.OpenTextFile(Server.MapPath(TextFile), 8, true)
f.WriteLine(Now()& ", "&Request.Form( "url ")& ", "&Request.Form( "adurl ")& ", "&Request.ServerVariables( "REMOTE_ADDR ")& ", "&Request.Form( "refer ")& ", "&Request.Cookies(UserName))
f.Close
Response.Write "OK "
End If
Set f = Nothing
Set fso = Nothing
Response.End
End If

If Request.QueryString( "act ") = "script " Then
Dim str
str = "function XHConn() " & vbcrlf
str = str & "{ " & vbcrlf
str = str & " var xmlhttp = false, bComplete = false; " & vbcrlf
str = str & " try { xmlhttp = new ActiveXObject( " "Msxml2.XMLHTTP " "); } " & vbcrlf
str = str & " catch (e) { try { xmlhttp = new ActiveXObject( " "Microsoft.XMLHTTP " "); } " & vbcrlf
str = str & " catch (e) { try { xmlhttp = new XMLHttpRequest(); } " & vbcrlf
str = str & " catch (e) { xmlhttp = false; }}} " & vbcrlf
str = str & " if (!xmlhttp) return null; " & vbcrlf
str = str & " this.connect = function(sURL, sMethod, sVars, fnDone) " & vbcrlf
str = str & "