Viadeo has a feature to reveal who visited your profile…. but you first have to pay to become a premium user.
But the way viadeo presents us the different profiles « anonymized » (cf picture1) contains a token which identify a profile. To illustrate this tiny breach in their business, I’ve created a small script you can launch when browsing the viadeo « profile visits view ».
Basically it replaces all links on profile cards by the user profile link whereas normally they point to the subscription page. The script also browses for you the different profiles and replace the labels by the real name and job position from your visitor (cf picture 2). Be careful that this latest option creates automated activity for your account and indicates to the profiles being revealed that you have visited them.
Before :
After:
The user understandable code is below, but I also provide a mini version (cf attachments) you can bookmark in your favorite browser to execute it whenever you are on the viadeo page (correct as long as viadeo doesn’t change its systems).
Code :
{codecitation class= »brush: javascript; »}/*
Copyright 2010 Gabriel Serme
Licensed under the Apache License, Version 2.0 (the « License »);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an « AS IS » BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
//Utility functions
function obValsl(ob){var r=[],mx=ob.length;for(var z=0;z
function tags(element, tagName){ return obValsl(element.getElementsByTagName(tagName));};
function getHTTPObject() { if (typeof XMLHttpRequest != ‘undefined’) { return new XMLHttpRequest(); } try { return new ActiveXObject(« Msxml2.XMLHTTP »); } catch (e) { try { return new ActiveXObject(« Microsoft.XMLHTTP »); } catch (e) {} } return false; }
/**
* Change label on a card, to indicate a message
* @parameter card : a user-card from viadeo
* @parameter withName : if true, scrap the name from profile (additional network requetsts)
*/
function changeLabel (card, message, withName){
//change label
var label = card.getElementsByClassName(« information »).item(0)
.getElementsByClassName(« main »).item(0)
.childNodes[0]
.childNodes[0];
label.innerHTML= message;
if (withName === true){
getNameFromProfile(label, card);
}
}
function getNameFromProfile(elem, card){
var pId = getPidFromCard(card);
if (undefined == pId)
return;
var http = getHTTPObject();
http.open(« GET », baseUrl + pId, true);
http.onreadystatechange = function() {
if (http.readyState != 4)
return;
//thx to http://www.anyexample.com/webdev/ajax/ajax_example__get_page_title.xml
try { var real_status = http.status; }
catch (e) { return; }
// status != 200 means that page was not downloaded
// error 404 happened or something like this
if (real_status != 200)
return;
// regexp which parses text for value between .. tags
var re_title = new RegExp(« [\n\r\s]*(.*)[\n\r\s]* », « gmi »);
// page text
var content = http.responseText;
var title = re_title.exec(content);
var emsg = »; // output text
if (title == null) // regexp didn’t match
return; //we do not change the current label
else
emsg = title[1];
//if everything is perfectly fine, we change label
elem.innerHTML= emsg;
}
http.send(null);
}
/**
@return Pid if a picture is present, or undefined
*/
function getPidFromCard(card){
var src = card.childNodes[0].childNodes[0].childNodes[0];
if (undefined == src){
return undefined;
}
src = src.getAttribute(« src »);
var pId = src.substr(src.indexOf(« memberId= ») + « memberId= ».length);
pId = pId.substr(0,pId.indexOf(« & »));
return pId;
}
/** Starting point */
var baseUrl = « http://www.viadeo.com/profile/ »;
var a = document.getElementsByClassName(‘user-card’);
//for all cards in the current page
for (var i=0; i
var card = a.item(i).childNodes[2];
var pId = getPidFromCard(card);
if (undefined == pId){
console.log(« Couldn’t extract member profile »);
continue;
}
//change all links from the card, except common contacts
var links = Array.concat(
tags(a.item(i).childNodes[0], « a »),
tags(card.childNodes[0], « a »),
tags(card.childNodes[1], « a »));
for (var j=0; j
var l = links[j];
l.setAttribute(« href », « /profile/ » + pId);
}
//temporary change label
changeLabel (card, « Wait for name », false);
}
//at this point, you can already click on picture or label to browse the profile
//second loop, to separate name fetching from simple url replacing
for (var i=0; i
var card = a.item(i).childNodes[2];
//change label, one per second
if (undefined == getPidFromCard(card)){
console.log(« Couldn’t extract member profile »);
continue;
}
window.setTimeout(changeLabel , 1000*i, card, « Wait for name – » + i, true);
}
{/codecitation}