Friday, March 26, 2010

<%

Function googleColor(value, random)
Dim colorArray
colorArray = Split(value, ",")
googleColor = colorArray(random Mod (UBound(colorArray) + 1))
End Function

Function googleScreenRes()
Dim screenRes, delimiter, resArray
screenRes = Request.ServerVariables("HTTP_UA_PIXELS")
delimiter = "x"
If IsEmpty(screenRes) Then
screenRes = Request.ServerVariables("HTTP_X_UP_DEVCAP_SCREENPIXELS")
delimiter = ","
End If
If IsEmpty(screenRes) Then
screenRes = Request.ServerVariables("HTTP_X_JPHONE_DISPLAY")
delimiter = "*"
End If
resArray = Split(screenRes, delimiter, 2)
If (UBound(resArray) + 1) = 2 Then
googleScreenRes = "&u_w=" & resArray(0) & "&u_h=" & resArray(1)
End If
End Function

Function googleMuid()
Dim muid
muid = Request.ServerVariables("HTTP_X_DCMGUID")
If Not IsEmpty(muid) Then
googleMuid = "&muid=" & muid
End If
muid = Request.ServerVariables("HTTP_X_UP_SUBNO")
If Not IsEmpty(muid) Then
googleMuid = "&muid=" & muid
End If
muid = Request.ServerVariables("HTTP_X_JPHONE_UID")
If Not IsEmpty(muid) Then
googleMuid = "&muid=" & muid
End If
muid = Request.ServerVariables("HTTP_X_EM_UID")
If Not IsEmpty(muid) Then
googleMuid = "&muid=" & muid
End If
End Function

Function googleViaAndAccept(googleUserAgent)
If Len(googleUserAgent) = 0 Then
Dim via
via = Server.URLEncode(Request.ServerVariables("HTTP_VIA"))
If Not IsEmpty(via) Then
googleViaAndAccept = "&via=" & via
End If
Dim accept
accept = Server.URLEncode(Request.ServerVariables("HTTP_ACCEPT"))
If Not IsEmpty(accept) Then
googleViaAndAccept = googleViaAndAccept & "&accept=" & accept
End If
End If
End Function

Dim googleTime, googleDt, googleScheme
googleTime = DateDiff("s", "01/01/1970 00:00:00", Now())
googleDt = (1000 * googleTime) + Round(1000 * (Timer - Int(Timer)))
googleScheme = "http://"
googleUserAgent = Server.URLEncode(Request.ServerVariables("HTTP_USER_AGENT"))
If StrComp(Request.ServerVariables("HTTPS"), "on") = 0 Then googleScheme = "https://"

Dim googleAdUrl, googleAdOutput
googleAdUrl = "http://pagead2.googlesyndication.com/pagead/ads?" &_
"ad_type=text_image" &_
"&channel=" &_
"&client=ca-mb-pub-9775756780121177" &_
"&dt=" & googleDt &_
"&format=mobile_single" &_
"&ip=" & Server.URLEncode(Request.ServerVariables("REMOTE_ADDR")) &_
"&markup=xhtml" &_
"&oe=utf8" &_
"&output=xhtml" &_
"&ref=" & Server.URLEncode(Request.ServerVariables("HTTP_REFERER")) &_
"&url=" & Server.URLEncode(googleScheme & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL")) &_
"&useragent=" & googleUserAgent &_
googleScreenRes() &_
googleMuid() &_
googleViaAndAccept(googleUserAgent)

Set googleAdOutput = Server.CreateObject("MSXML2.ServerXMLHTTP")
googleAdOutput.Open "GET", googleAdUrl, false
googleAdOutput.Send
Response.Write(googleAdOutput.responseText)

%>

No comments:

Post a Comment