Tag Archives: stats

Get Twitter and Facebook Link Statistics with JSON and jQuery

Both Twitter and Facebook have little JavaScript widgets that allow you to share a page using the respective service, displaying a running total of users who have done so. While that’s fine for most purposes, what if you just need the count, for some atypical application?

It’s not well-documented, but the two social media sites have JSON APIs for that purpose.

With a little bit of jQuery magic, you can collect the values on page load and update the DOM with the number. Here’s something I threw together for a project I was working on:

(function() {

var url = 'http://xkcd.com/792/';

jQuery.getJSON("http://urls.api.twitter.com/1/urls/count.json?url="+url+"&callback=?", function(data) {
jQuery('#socialstuff span.twcount').html(data.count);

jQuery.getJSON("https://graph.facebook.com/"+url+"&callback=?", function(data) {
jQuery('#socialstuff span.fbcount').html(data.shares);


As long as you remember to include jQuery, and have the right HTML elements for the JavaScript to populate, it’s pretty much plug-and-play.

You can see it in action here.

Ego: iPhone Statistics Dashboard

Want an easy, at-a-glance dashboard for monitoring basic website statistics from your iPhone? Ego fits the description, if you don’t mind the $1.99 price tag.

The app will aggregate statistics from Google Analytics, Feedburner, Mint, Ember, Twitter, Vimeo, Tumblr and Squarespace. You can even have multiple accounts from each service active.

The UI is great. It’s one of the best things about the app.

Ego won’t give you fancy in-depth information like bounce rates or the percentage of viewers who use Firefox; it just shows you the most important figures in one accessible place.

How to Display a FeedBurner Average

Tired of ever-fluctuating FeedBurner counts being displayed on your blog? Why don’t you just display a weekly average? Cats Who Blog has a tutorial that shows you how you can retrieve the numbers via the FeedBurner API, average them, and display a rounded figure.

Why do the stats fluctuate in the first place? In addition to the occasional FeedBurner flakiness, the service measures the number of feed aggregators that have pinged the feed in a single day. Stats, of both RSS and website page views, tend to be lower on weekends than weekdays, for example.

How to get a more relevant Feedburner count [Cats Who Blog]

Google to Offer Users a Way to Opt-Out of Google Analytics Tracking?

A somewhat vague post on TechCrunch, linking to a Google blog posting of equal nebulousness, suggests that Google will soon be releasing a browser plugin to enable users to opt-out of being tracked by Google Analytics.

Over the past year, we have been exploring ways to offer users more choice on how their data is collected by Google Analytics. We concluded that the best approach would be to develop a global browser based plug-in to allow users to opt out of being tracked by Google Analytics. Our engineers are now hard at work finalizing and testing this opt-out functionality. We look forward to make it globally available to our users in the coming weeks.

Speaking as someone who operates several websites: what? Does this mean tinfoil hat-wearing users will be able to opt-out of whatever habit-tracking information Google may collect for their own purposes, or does this mean they will be releasing a product that cripples their popular website statistics package?

Anyone running a website needs to know how much traffic they get, what the most common screen resolutions used are, what browsers visitors primarily use to access the site, and who’s linking in. Without that basic information, that poses absolutely no privacy threat, you’re flying blind. I assume that Google wouldn’t be stupid enough to build and promote a browser extension that could render their own statistics service useless?

I have no problem with people being able to opt-out of any questionable behavior tracking (i.e. following users from site to site) that Google may be doing behind the scenes, but I don’t want Google Analytics to become absolutely useless. I may be overreacting, but the Google bloggers certainly could have been more clear.

Dayta: The One Week App

Developer Sahil Lavingia built a high-quality iPhone app in only one week, and blogged about it on the One Week App blog. The resulting application is called Dayta.

Dayta is designed to help you log any sort of data set that you wish to track over time. How many miles do you drive between refilling your gas tank? How much money did you spend on iPhone apps last month? Is your World of WarCraft guild improving its raid success ratio? You can create a Dayta log for anything.

You can recall data points by date, or view them on a graph. The charts Dayta generates are simple, and much like Google Analytics in style.

Continue reading →

Get Live Access Logs With a Simple Linux Command

Here’s a neat little trick for those of you with SSH access to your Linux server. You can use a simple command to get a live-updated stream of your access log, so you can see hits as they come in. It’s sort of like the “spy” tool in Woopra or pMetrics, but geekier and with less visual polish. :)

Linux "tail -f" on an Apache Access Log

First you need to connect to the server with SSH. Once you’re in, change your working directory to wherever Apache stashes its log files on your system. On my Ubuntu install it’s /var/log/apache2. So I would type cd /var/log/apache2 to switch to that directory. Next, run the tail command like so:

tail -f access.log

Tail normally outputs the last several lines of a file and then returns to a prompt, but with the -f argument it continues to monitor the file for changes, and outputs them. So as the Apache server writes to the log file, tail spits the new lines out on your screen.

When you’re done, press Ctrl+C to terminate the tail process and go back to the shell prompt.

Compete.com: Compare Your Site With the Competition

Have you ever wondered how your site stacks up against its competitors? Most people don’t make their traffic stats available to the general public, though doing so can attract advertisers…

That’s what Compete.com is for. They use some secret methods to estimate site traffic, and allow you to compare sites against each other. It’s accuracy is pretty good too. I compared a graph of Webmaster-Source’s unique vistors over the course of a year with the same time frame from Google Analytics. The results were close enough.

It’s dead-easy to use Compete. Just input your domain and a competitors’ or two. You get a graph like this back:

Compete.com Graph of Webmaster-Source and Pro Blog Design

The default graph shows unique visitors over a period of one year. You cna switch it to pages per visit, “attention,” average stay, or if you pay for premium service, pageviews. It also offers some other interesting figures, such as high-traffic search keywords and growth. You can embed graphs on your website too, such as on an “Advertise Here” page.

It’s on, Michael. :)

Traffic Sources: Where Are Your Visitors Coming From?

Check your blog’s statistics. Where are your visitors coming from? Are they mainly typing-in your blog’s URL, coming from search engine results pages (SERPs), or are they being referred to you from other sites?

Google Analytics puts an overview of this information on their dashboard, and offers more detailed data on a separate page.

The Traffic Sources chart on the Analytics Dashboard provides some valuable insight on your readers, and how they view your blog.

What do the numbers mean?

  • Referring Sites, er, refers to how many unique visitors came from other sites. E.g. blogs linking to you, traffic from social bookmarking sites.
  • Search Engines – the traffic coming from SERPs.
  • Direct Traffic – People who manually typed your domain in.

Direct Traffic is mainly composed of the people who visit your site frequently. This includes RSS subscribers manually visiting your sites, as well as links clicked from desktop RSS aggregators.

Referring Sites means “pretty much anything coming from another domain.” This includes social bookmarking sites like StumbleUpon and Digg, links clicked from web-based RSS aggregators, and links from other blogs.

Optimally, you want to have a significant amount of direct traffic, signifying loyal readers, plenty of referrals, and some steady traffic from search engines. The ratios between the percentages depends on many factors, such as your niche. If there are a lot of blogs in your niche, you may have a lot of referrals. The same goes for if your site is popular among the StumbleUpon and Digg crowd. Smaller niches may have more traffic from search engines than referrals.

How are your blog’s traffic sources proportioned?

Crazy Egg – Visualize Your Visitors

Crazy Egg is one of the most useful tools you can add to your blogger’s arsenal. Have you even wondered what your users do on your blog? Crazy Egg can tell you that.

Crazy Egg is a service that generates heatmaps showing the most-clicked spots on your blog. Those maps are some of the most valuable data you can use to improve your site. Does anyone ever click that ad block you put in your sidebar? Is your RSS link in a noticeable spot? Find out with Crazy Egg.

Crazy Egg is free if you don’t mind a few limitations (caps on the number of trackable visitors, and the number of pages you can track at once). Paid plans, for those who need them, range from $9-$99 per month, depending on your needs.

Crazy Egg is a really useful service, and worth trying out.