AJAX tracking with Google Adsense click advertising
Related Tags:
Function
Can complete access to every detail of a user clicks on advertising data. Including click, the user's IP, page source address, the click advertising Web site addresses, if you kept on the site if the user cookie, or even about the users point Which is your advertising.
With pure client javascript code and click on AJAX technology to monitor and click send data server, service-I use the ASP script is used to preserve data and to provide click-click browser enquiries can be replaced by other service - scripts, such as PHP, JSP, etc..
Simple way to preserve data, I used pure text version of preservation, preservation of a party data, data fields separated by a comma, this user-friendly text Save this for csv format, will be able to use excel csv opened.
View ad click data can be password for access
Installation and use of
Download this document to extract the document inside the adLog.asp
AdLog.asp opened with Notepad to find the following lines:
Const TextFile = "adLog.txt" 'Save click on the text data files, is a relative path, can be amended
Const AccessPassword = "adLog" 'Show click on the visit password can be set themselves, if not identity, please AccessPassword value of the words "" can be
Const SessionName = "google_ad_logger" 'Session name, to preserve access password to the designated Session of
Const WebCharset = "utf-8" 'website coding type, if the GB-2312, to amend its own
Const UserName = "username" 'user name cookie, if your station without user cookie, and leave the
Can be modified according to their actual needs of its value
Revised document will be uploaded to your web site, under any path can be. Here Note: If your coding is gb-2312, I would be grateful if this document using Notepad open, and choose Save as, will be back for the ANSI code.
Laws you put in a google advertising pages document, the following code will be inserted into your pages arbitrary position:
<script Language="javascript" type="text/javascript" src="http://www.example.com/adlog.asp?act=script"> </ script>
Pages path which will be revised to address your own reality
After the completion of the installation began tracking pages automatically clicking on the advertising
Show the data you can click on the ftp download the text file you specify Show, or visit http://www.example.com/adlog.asp
Principle
In fact, this is not what is highly technical, and the simple principle, core functions are in the client javascript.
Show google found through advertisements placed in a iframe code in all. Therefore, first passed document.getElementsByTagName ( "iframe") have all iframe tag page elements stored in a set of arrays
Iframe.src then iterate check whether the value of the "googlesyndication.com" This string of string, on the view that if the iframe is google ads are displayed iframe
Display ads by google after the iframe to add a onfocus iframe this incident, elements of this case is that when the focus was triggered when the incident
Onfocus incident in check window.status value, which is shown in the status bar string matching "go to" and "key even to" a few strings on the extraction of web site addresses, the address that was on Click on the web site advertising
AJAX immediately use the user's data click POST-service record, no longer here AJAX-response services back to the data, just be sent out
Several core code
Procedures for the preparation of the windows of a friend will be aware that Microsoft's Visual Stdio Spy contains a small tool, this gadget out of a function used to monitor a window handle all trigger events, with up feel so cool, I write Advertising for the record also has its own website used a Spy, the code below:
<input Type=text id=test> <br />
<textarea Cols=80 rows=20 id=view> </ textarea>
<script Language="JavaScript">
Obj = document.getElementById ( "test");
Var v = document.getElementById ( "view");
For (evt in obj)
If (evt.substring (0,2) == "on") eval ( "obj." Evt "= function () (v.value = '" evt "incident triggered \ \ n' v.value)") ;
</ Script>
I just use this method Show iframe on the trigger events Show found mouse click iframe can receive in the incident onbeforeactivate, onactivate, onfocusin, onfocus four, I chose a onfocus to monitor users click .
Ajax part I use the XHConn components, compact and flexible simple, so good.
On the front at the time of installation I deliberately included js code that can be positioned anywhere on the Web, where I use the one called the js domFunction components, the components can be achieved cycle for DOM objects until they find loaded into DOM page and effective implementation of the code later, the role of the equivalent document.onload incident, google adsense ads will show sometimes very slow with this Dom inspection procedures can be assured that each page can be loaded View to google the iframe, foolproof, but also convenient for users add the code do not need to consider the impact of the position.
Theory, this procedure should be written in an asp plus a js two documents, but read brother Andy on a single page application (Single Page Application article, I admire, a specially wrote two documents of a document.
Storage and Retrieval services-the contents of a text file, I use the FSO and ADODB.Stream is, if your site does not support these components, please contact me, I rewrite other way.
Regrettably
The most regrettable is that this procedure can only be used under Kai role in IE, Firefox unable to track users click operation, the reasons for Firefox is in the fundamental ifrmae not trigger any user operation, to view information on Mozilla, the official explained by document.getElementById ( "iframe"). contentWindow this object, but I will try to post or no role, had to give up and wait for Senator solution.
Most ashamed of how I could not find any incident in the onfocus judgement about button mouse users, in the iframe click on the right mouse button will trigger events, the program will be considered an effective user clicks on this issue will definitely should be changed to.
Demo and Download
If you want to immediately see the actual operational procedures, I deliberately provided a demo documents: http://www.duduwolf.com/test/adLogDemo.asp, this document has no access password, anyone can click on View data, you can be loaded <script language = "javascript" type = "text / javascript" src = "http://www.example.com/adlog.asp?act=script"> </ script> this series immediately from your code Click on the web site tracking to achieve, but after clicking on the data is stored on the website and I was open to the public.
Download source files: Google Adsense Click Logger
View the source code online: View the source code (utf-8, showed that changing the current page hash coding)
Concluding remarks
This procedure I spent a few days, has yet to publish it is worried that large-scale application of estimates will be revised after google google adsense code, the other is I do not know it is not contrary to the provisions of the reservation google ads carefully Show This was found after a
Google is prohibited by any means to increase artificially the number of hits or page number display, and through artificial engineering systems and analysis of the act closely monitored.
Therefore, I hope that everyone is used as technical studies, not a long time, click on this track, although this procedure does not affect any adsense invest and click on the movements and behaviour, but if there is one day of staff personally google on your site Study code on the whole exposed. I blog on the statistical data for several days, and Basic statistical data provided by google almost, because my blog on the user's cookie message, so I deliberately kept the user name, would like to see every day who are in the click, I advertising, I click statistics found no people in the advertising messages in the blog, in blog message in the cookie preserve users never click on the ads
- Two floating in the pages of advertising code
- Couplet advertising Close button production
- Mandatory Access your advertising
- Internet media advertising alone Yangbuqi
- Google AdSense advertising display
- Analysis fully floating advertising code
- JavaScript code used web advertising
- Internet advertising on Google and some attention to the issues
- Web advertising: click to fraudulent advertising for throwing white
- China's Internet search engine advertising more targeted advertising and invest
- Share of the surge in Internet advertising Fresh traditional advertising market
- Enhanced the website advertising effectiveness of the nine tips
- Css filters advertising rotation
- Fluttering on the website advertising design
- "Love" a new advertising Xplus profitable advertising model
- SupeSite site how to increase their advertising?
- Mandatory click advertising Dafa
- How to use your promotional advertising exchange website
- Function with the closure of the Joint advertising code
- Google Adsense advertising three theorems




