Forums » Developers



API: Getting Current Visitors-Online AND Yesterday's Most Popular Outgoing Link

I want to get both pieces of data in one url, but can't get it to work. When I specify date=yesterday for the links-outbound, the visitors online will no show up.

Here's what I'm doing: http://api.getclicky.com/stats/api3?site_id=xxxxx&sitekey=xxxxxxxxx&type=visitors-online,links-outbound&limit=1&date=yesterday&unserialize&output=php

And here's the array it produces:

Array
(
[visitors-online] => Array
(
)

[links-outbound] => Array
(
[2009-06-07] => Array
(
[0] => Array
(
[title] =>
[value] =>
[value_percent] =>
[url] =>
[clicky_url] =>
)

)

)

)

Any ideas on how to make this work?

Thanks.

Posted Mon Jun 8 2009 7:26p by affbu***


Yeah visitors-online only works for date=today. You'll have to make two seperate calls for this.

Ah screw it, I guess it makes sense to be able to call it when another date is set, even though it will always return the "live" value. So I just made this change to API3, try it again and see if it works :)

Posted Tue Jun 9 2009 10:32a by Your Friendly Clicky Admin


Thanks for setting that up! Both values return now, but it's pulling a different visitors-online number. The documentation says visitors-online is always the live value, but when I use &date=yesterday, the date in the visitors-online array shows yesterdays and it displays a different number than if I leave out the date=yesterday. My guess is it's pulling yesterdays visitors-online number for that time...But it'll work for now!

thanks again!

Posted Tue Jun 9 2009 8p by affbu***


So the visitors-online displays a different number if I use date=yesterday from date=today, I've also noticed that if I add &limit=1 I'll get a different visitors-online number than if I don't include it, and if I change to &limit=2 I'll get a different number than both.

Complete accuracy doesn't *really* matter that much (I know there's a 5 minute delay anyway) but I'm just trying to figure out why mine has said there's been the same amount of visitors online for the last few hours when I know it's completely inaccurate...

Posted Tue Jun 9 2009 11:17p by affbu***


Oh I know, it's because since date=yesterday, we cache for a lot longer (24 hours), since theoretically that data is now fixed (e.g. no longe rbeing updated since it's in the past). The reason "limit" is changing the value is probably because it's forcing it to grab a new value, since the request is different.

I guess you'll just have to make it 2 seperate calls to the API... sorry.

Posted Wed Jun 10 2009 4:19p by Your Friendly Clicky Admin


You must be logged in to your account to post!