
[Request] display alexa rank from my site in personal message - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [Request] display alexa rank from my site in personal message (/showthread.php?tid=77639)
[Request] display alexa rank from my site in personal message by ezak on 09-20-2007 at 08:47 PM
is that possible to get alexa rank for my site in my personal message
thanks in advice
RE: [Request] display alexa rank from my site in personal message by phalanxii on 09-22-2007 at 08:11 AM
Here's a quick script that should do the job: code: var PSM = "Alexa Rank: %alexa%";
var URL = "www.google.com";
function OnEvent_Initialize(MessengerStart) {
if (Messenger.MyStatus > 0) {
MsgPlus.AddTimer("UpdateTimer", 1800000);
UpdateAlexaRankPSM();
}
}
function OnEvent_Timer(TimerId) {
MsgPlus.AddTimer("UpdateTimer", 1800000);
UpdateAlexaRankPSM();
}
function UpdateAlexaRankPSM() {
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", "http://xml.alexa.com/data?cli=9&dat=nsa&url=" + encodeURI(URL), true);
xmlhttp.send();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
Messenger.MyPersonalMessage = PSM.replace(/%alexa%/g, xmlhttp.responseText.match(/^145 (\d+)$/m)[1]);
}
}
}
This will update your PSM with your site's Alexa Rank every 30 minutes. Just change the highlighted red text to your own custom PSM (where "%alexa%" will display your site's ranking) and your website's URL.
RE: [Request] display alexa rank from my site in personal message by ezak on 09-22-2007 at 02:43 PM
ohh thats amazing phalanxii , thanks alot bro
but I think there is something wrong
my site rank now it 21,405
and with your scipts show thats is 22,956
whats wrong in this ?
and thanks alot for you help
RE: [Request] display alexa rank from my site in personal message by Matti on 09-22-2007 at 04:15 PM
What's your site? It sounds like a very weird phenomena that the script would display a different ranking.
RE: [Request] display alexa rank from my site in personal message by ezak on 09-22-2007 at 04:31 PM
my site is http://www.gem-flash.com
and you can see the rank here http://www.alexa.com/data/details/traffic_details?url=gem-flash.com
its show that
Gem-flash.com has a traffic rank of: 21,405
and you can see the script
RE: [Request] display alexa rank from my site in personal message by Matti on 09-22-2007 at 04:44 PM
That's very strange indeed. However, it seems to be a problem with Alexa itself, because the data which the script tries to retrieve contains this faulty rank.
I just checked "google.be" too and there's a mismatch there too. Very strange...
RE: [Request] display alexa rank from my site in personal message by phalanxii on 09-23-2007 at 12:56 AM
Yes, I noticed that with a few other websites, so I've written another script for you which takes the site's Alexa Rank straight off the website. code: var PSM = "Alexa Rank: %alexa%";
var URL = "http://www.gem-flash.com";
function OnEvent_Initialize(MessengerStart) {
if (Messenger.MyStatus > 0) {
OnEvent_Timer();
}
}
function OnEvent_Signin(Email) {
OnEvent_Timer();
}
function OnEvent_Timer(TimerId) {
MsgPlus.AddTimer("UpdateTimer", 1800000);
UpdateAlexaRankPSM();
}
function UpdateAlexaRankPSM() {
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", "http://client.alexa.com/common/css/scramble.css", true);
xmlhttp.send(0);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var Scramble = xmlhttp.responseText;
xmlhttp.open("GET", "http://www.alexa.com/data/details/traffic_details?url=" + encodeURI(URL), true);
xmlhttp.send(0);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var Rank = "";
var Raw = xmlhttp.responseText.match(/->(.*?)<\/span><b/)[1].match(/(?:"[^"]+")?>?[\d,]+<?/g);
for (var i = 0; i < Raw.length; i++) {
if (/^"([^"]+)">([\d,]+)<?$/.test(Raw[i]) && !new RegExp(RegExp.$1).test(Scramble)) Rank += RegExp.$2;
else if (/^>?([\d,]+)<?$/.test(Raw[i])) Rank += RegExp.$1;
}
Messenger.MyPersonalMessage = PSM.replace(/%alexa%/gi, Rank);
}
}
}
}
}
As before, change the red text to suit your needs. This script is slower than the other one because it has to load more data (including a nasty scrambler system ), but the end result is that it reflects the same rank as the web page. Enjoy!
RE: [Request] display alexa rank from my site in personal message by ezak on 09-24-2007 at 01:46 PM
yes its working perfectly phalanxii  
thanks alot for you help mate
|