Medium Statzler: Article Stats to Google Sheets & Excel
Hey “Medium”ites!
I’m been looking around for quite some time on how to download my Medium.com article stats to understand things such as:
- How much $$ am I making per day per article?
- How do my stories’ views compare to each other?
- On what publications do I make the most money?
However, I found that…
There really isn’t a good way to get these statistics, especially earnings data.
So that’s why I’ve created Medium Statzler, a free and easy way to grab your Medium.com stats.
I’ve also created a Google Data Studio dashboard template that you can use once you have your data ready in Google Sheets.
Medium Statzler: What is it?
Medium Statzler is a Python script that:
- Logs into Medium.com (Automatically or with your manual login).
- Grabs your article stats from the homepage and articles’ pages.
- Posts the data into Excel and/or your Google Sheet.
Want to use it to grab your articles’ stats?
Let’s set it up!
How to Get Your Articles’ Stats with Medium Statzler
Step 0: Set up Python & PyCharm
— If you don’t know how to do this, please read my article Automating the Boring Stuff With Python (Example). It will guide you on how to set up PyCharm and Python.
— If you don’t want to do this, I’ll be making a .exe version that I will upload soon!
Step 1: Get the code
Go to my GitHub Repo Medium Statzler and grab the Main_Program.py file. It’s a beauty!
Of course, you’ll want to install the necessary packages. Do that before going to Step 2.
Step 2: Get your Google Authentication API .json file
To connect to Google Sheets from Python, you’ll need to allow get your Google Drive credentials set up.
How: Go to https://www.analyticsvidhya.com/blog/2020/07/read-and-update-google-spreadsheets-with-python/ and follow the steps on how to get your .json file. It’s a good tutorial!
Once you have your Google credentials .json file, save it to your computer and remember where you saved it. You’ll need the file path location for Step 5.
Step 3: Get Selenium ChromeDriver
You’ll need to get Selenium Chrome Driver to interact with the program in your web browser. I know… One more step to do.
How: Go to https://chromedriver.chromium.org/downloads and get the ChromeDriver version that matches your version of Google Chrome.
Which version should I get? Don’t know what version of ChromeDriver you need? Type “chrome://settings/help” into your Google Chrome address bar and find your Google Chrome version #.
Step 4: Setup Your Google Sheet
Use my Google Sheets datasheet template here to make your own Google Sheet in your Google Drive account. This will be the place where your Medium.com stats will be sent to.
Take note of what you name the workbook and sheet as you’ll need those for Step 5.
Step 5: Insert Your Login / Google Sheets Data
I’ve tried to make the process as automated as possible to login with Google and get the stats. But to try it, make sure you insert your values into the ‘ ’ spaces where they go.
Step 6: Run Program and Interact with Opened Chrome Browser
Follow the prompts to login to Medium.com. You might have to do 2-factor authentication, but however you get in, just make sure you can get your personal Medium.com page.
Once you’re logged in, the program will start grabbing your stats from the pages.
When it’s completed, you’ll see this:
If you have any errors, google them and hopefully you’ll find the error reason.
If you saved your data to Excel, your file will open. :)
Step 7: Connect Data to Google Data Studio
Use my Google Data Studio template to make your own dashboard. Connect your Google Sheets to start tracking your stats.
There are many ways to analyze your articles’ data. If you want to get SUPER funky with it, you can do the change over time between dates for certain variables to get the amount you were earning on specific dates. #Calculus_For_The_Win!
That’s it! Now you can get your Medium.com article stats automatically zipped into a Google Sheet / Excel file without having to copy/paste anything!
Woot Woot!
Notes:
- Kudos to Uyen Tran for making the logo and images.
- Medium might change their page layout anytime and mess this up, so please be patient if the program needs to be updated.
Updates:
(19-August 2020) — Wrote the article and made the GitHub repo!