Go Links New Feature: Public Hit Count

So…..say you’ve got an awesome Go Link, and you want to show the world how popular it is. You could log in, view the statistics, and then manually post the hit count on your website somewhere. That would be okay, I guess, but it sounds like a lot of work.

What if there was a way for you to easily grab the hit count for a Go Link, and display it in any way you wanted?

Enter a new feature for Go Links: Public Hit Counts.

By default, all Go Links have their ‘Public Hit Count’ option switched off. That means, if you want to display your hit counts publicly, you need to turn it on. Just do so via your link details screen, on the Statistics tab.

Once you have it turned on, you can visit a URL specifically for your hit count. It is formatted like this:

  • http://golinks.ncsu.edu/index/get-hit-count-for-link/link/[your-link-here]

For example, the hit count data for the Go Link “oitdesign” is this:

If you go there, you’ll see some data on the screen. That’s JSON, and it’s the way Go Links provides the data to you, so that you can parse and display it any way you want.

Example:

Using the “oitdesign” go link and some PHP code, we can make a simple box to display the hit count on our website.

1. First, set up the call to the Go Link Hit Count URL.

2. Next, display the data from the Go Link somewhere on your page.

3. Finally, give your display some css style to make it look better than just a number on the page.

4. Here’s the end result:

That’s it. If you know how to work with JSON, this will be super simple for you to make your own. If you don’t, let me know and I’ll see if i can help point you in the right direction.

Download the file with all the code here.