written on 11/04/2018
How to get total views and reads statistics on Medium
Ever been annoyed that you could not see your total views, total reads, and fans on your medium story stats page?
You can clearly see that the medium stats page is lacking a general overview area where you can see how your blog article performed over the whole lifetime of your blog. I was really annoyed about this particular issue but since I am a programmer I worked on a simple solution for everyone, especially you, could use to circumvent this problem.
The only thing that you need is a modern web browser. I recommend using Chrome or Firefox. The first thing you have to do is to go to your stats page which you can reach by browsing to https://medium.com/me/stats. After you have done this you need to open the developer tools of your browser.
Chrome:
Mac: Command + Option + J ( ⌘ + ⌥ + J)
Linux and Windows: Control+Shift+J
Firefox:
Mac: Command + Option + K ( ⌘ + ⌥ + K)
Linux and Windows: Control + Shift + K
After you have opened the console you need to paste the following script:
1const totalTypes = {2VIEWS: 2,3READS: 3,4FANS: 55};67const getTotal = tableColumn =>8[9...document.querySelectorAll(10`td:nth-child(${tableColumn}) > span.sortableTable-number`11)12]13.map(e => parseInt(e.getAttribute("title").replace(/,/g, ""), 10))14.reduce((a, b) => a + b, 0);1516console.log({17totalViews: getTotal(totalTypes.VIEWS),18totalReads: getTotal(totalTypes.READS),19totalFans: getTotal(totalTypes.FANS)20});
You can find the source code of this script also here: https://gist.github.com/igeligel/b2e1ab401ed3f96dcf1030045224fb2c
After inserting the script and pressing enter you should end up with a result like this:
In the last line, there is something written which is undefined but do not bother about it. The line above is more important because there you can see the aggregated data about total views, total reads and total fans which might be interesting for you.
I hope this article helped you a bit and I really hope medium is going to work on those statistics pages a lot and give us writers more insights into the data. Medium is still a great platform and I enjoy to write blogs here.
Thanks for reading this. You rock 🤘 If you have any feedback or want to add something to this article just comment here. You can also follow me on twitter or visit my personal site to stay up-to-date with my blog articles and many more things.
You might also like
Auto formatters for Python
🔥Save time by using the best auto formatters for python - a comparison to find the best for Python 2 and Python 3
Vue.js review of 2017
Vue.js had amazing growth throughout 2017, after the release of version 2 of the framework in 2016 the ecosystem grew drastically. This and more in Vue.js in 2017 is covered here.