Sort all the j.mp links by most clicked

bit.lysortingurl-shortening

Is there any way I can get all of the links associated with my j.mp account and arrange them so that the links with the most clicks are at the top?

Best Answer

Note: j.mp is actually bit.ly

You can use the Bitly API (link metrics) to get the number of clicks for each link.


I'm pasting here an answer from WebMasters on this topic:
(I think this question should be migrated)

Consider using a URL shortening service such as bit.ly to get click data about a list of links. Here's how it would work:

  1. You'd use bit.ly shortened links for all links in your list.

  2. When a visitor clicks a bit.ly link, bit.ly increments the click count and stores it on their server.

  3. When a user visits your page – but before the list is displayed to them – your script would determine how many clicks each link has received using the /v3/clicks/ method from the bit.ly REST API, which returns click data about multiple bit.ly links you supply.

  4. You would sort this information by the total number of clicks, display the list, and optionally show the number of clicks for each link.

  5. You may also choose to cache the results of this request in your database and only request new data once an hour/day.