Index User Clicks in the Yioop Search Result Page

The main task for the deliverable is to send the user clicked URLs in the Yioop search result page to the search engine. This is achieved by creating a scheduled data file in the yioop_data folder. The file should contain the search keyword, source url, destination url, timestamp and language.

For this, I have modified the extension developed by Vijaya Pamidi, Dr. Pollett's previous student to capture these data and send it to yioop.

On clicking the link in the Yioop Search result page, the following function gets called

var language = content.document.getElementsByTagName("html")[0].getAttribute("lang");
if(language == null){
language = content.document.getElementsByTagName("html")[0]
.getAttribute("xml:lang");
}
var queryURL = window.content.location.href;
var word = queryURL.split("q=").pop().replace("+"," ");
var URL = event.target.href;
var time = new Date();
var yioopurl = "http://localhost:85/yioop/";
var record = word + "|:|" + URL + "|:|" + queryURL
+ "|:|" + time + "|:|" + language + "\n";
var present = queryURL.indexOf("yioop.com");
if(present != -1) {
uploadAsyc(yioopurl, record);
}

and the uploadAsync() function sends the data to Yioop server

var params = "c=traffic&u=root&p=&a=toolbarTraffic&b=" + record;
var xhr = new XMLHttpRequest();
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send(params);

In the Yioop Server part, there is a controller which reads the parameter sent by the extension code and writes to the path ..\yioop_data\schedules\ToolbarData<timestamp>\15314\At<timestamp>From<localAddress>WithHash<HashValue>.txt