In a world where a keyword’s search volume is no longer the full picture, some of the most surprising and top performing content ideas actually come from breaking new search terms, i.e. (Google) trends.
While search volumes usually display a similar pattern of seasonality every year, unless something (circa 2020) radically changes, hidden gems in the form of new rising trends in a specific industry or around a certain topic are incredibly hard to be on top of.
In this article I will be sharing my way of making this simple, but I’ll also be sharing my learnings and processes, “recipe blogger style”😉 because it’s an inseparable part of coming up with this tool, but if you’re here for the bottom line, that’s ok too🐍🔥 here you go:
The Challenge: Making the most out of the ‘Related Queries’ box on Google Trends
Unfortunately, there’s no Google Data Studio connector for Google Trends, so if you’re constantly on the lookout for new breaking content opportunities like me, you constantly reach this little box at the bottom of GTrends after you’ve searched for one keyword at a time per geo, per timeframe. You can download this information you get per search, but at the end of the day, you’ll probably be on this for a while exporting excels, one per keyword, joining them together, creating a visual or report. Not amazing.
The Idea: Using the Google Trends API with Python
When you really want this information and the straight-forward GDS connector is not an option, a quick Google search would lead you to the understanding that the only way to get this information is by requesting this information directly from the Google Trends API, and the only way to do that is by (Python) coding.
What are your options?
- Getting a Python developer to do this for you (if you know one/can afford one)
- Keep calm, learn Python & do it yourself (not easy, but definitely possible)
- Learn SOME python, enough to be able to adapt other pieces of code from the SEO community for your specific needs. (100% doable)
I went with door no. 3 (despite constantly working on improving my python skills so these skills can be considered more than “some python😉), with a little bit of help from my dev friends back home (outside Twitter) along with a help, guidance and tips from the SEO Community Python thought leaders, also known as the SEO Pythonistas
The SEO Pythonistas
The SEO industry is really blessed with some of the most brilliant Python minds🐍🔥, from the Maestro that was Hamlet Batista (who I dedicate this post and every py-win to), to the brilliant SEO Pythonistas who were also inspired by Hamlet’s legacy, who keep creating amazing tools, scripts and offer tips and support for beginners.
The most active of these Pythonistas which you should definitely be following are Charly Wargnier (founder of SEOPythonistas), JC Chouinard, Greg Bernhardt, Ruth Everett, Koray Tuğberk GÜBÜR, Daniel Heredia Mejias, Moshe Ma-yafit and “The Professor” Elias Dabbas.
Lucky for us and thanks to them, we won’t be inventing the wheel here. Also, making existing code do what YOU want, is actually not too bad of a skill to have.
The Solution (V1): Python with Google Colab (Template)
The wonderful Ruth Everett and Hülya Çoban have both written excellent posts and provided detailed pieces of code for you to try and experiment, as I did:
- An Introduction to Using Google Trends with Python, Ruth Everett
- Visualising Python and Google Trends, Ruth Everett
- Learn how to chart and track Google Trends in Data Studio using Python, Hülya Çoban (SEL)
- A better GDS dash & Google Colab, Hülya Çoban (Twitter)
Ruth and Hülya both leveraged the power of the Google Trends API Python Library, PyTrends, and they explain how to use it from scratch so you don’t have to. If you’re still not sure you’re ready for checking in the API itself, their articles include the code they’ve used (on Google Colab) for you to play around with by following their user-friendly instructions on your own copy, which I can guarantee I’ve tried & tested.
Before you panic, Google Colab is a way for developers to share their code with each other, a Google Docs for developers if you will. It’s less scary than it sounds, and without ever working with it before, it was quite straightforward to understand with the instructions within provided by these experts. All you have to do is go to Runtime -> run all, and you’ll be able to easily see the output from each box of code and see the code that generates it (disclaimer: I have briefly worked with Jupyter Notebooks which is the same concept but still different).
My Google Trends Dashboard (Colab)
By slowly understanding the output of each of Ruth and Hülya’s code boxes, combined with my beginner-intermediate level in python, I slowly started to adapt it to my needs.
Here’s my original Google Trends Analyser Colab
The current code on there will provide you with 3 months Google Trends Related KWs data for the UK Furniture Industry.
Clearly this is just an example, but you can create a copy of it, hit Runtime -> Run all and also double click to show code to understand exactly what the code does and where to change it (spoiler alert: Don’t think too hard, all instructions are inside the colab😉).
Though it’s not the prettiest thing in the world (though probably the prettiest colab you’ve seen), I’ve worked hard on making it utterly friendly with all of the emojis (gifs too, if I could) and hidden code (view -> Show/hide code) that just provides an output. After testing it on non-SEO, non-techy users, I can definitely say that just running it requires no coding skills whatsoever.
Just one last important note: Do not change the order of the boxes (even though you physically can) because the code has to run in order, especially on the 1st three boxes of code, but anything else can change. From order of the tables to the text inside the boxes etc.
Just bear in mind that due to API limitations, only 5 calls to the API can be done, i.e. up to 5 kws at a time.
Disclaimer: Google Trends with Google Data Studio
The next step on Ruth and Hülya‘s articles is to visualise it on Google Data Studio, this has been the hardest step (as of that point in time😉). Despite the colabs being provided, I just couldn’t get it to work and didn’t understand why. I also didn’t really understand the kind of output I’d be expecting.
What I’ve learned from my GDS to Google Colab experience:
- There is no Google Colab -> Data Studio connection (there is a pattern here of me being unlucky with connectors😉). At least not directly anyway.
- The real connection is this: Google Colab -> Google Sheets -> Google Data Studio (a little free kw stuffing there for ya).
- So the way it works is that their Google Colab output (once you’ve followed the code and also inserted the Google auth code), will produce 1 or 2 Google Sheets (depending on the colab), which you’ll then have to go to your Google Drive to discover and then use the Google Sheets connector to plug it in, so every time you run the colab, the GDS report will update.
- However, this is not a simple colab to run: It includes the Google auth code to plug in, you gotta make sure it doesn’t create a new sheet all the time but just updates the current one, and then refresh data on GDS.
- I am not aware of a python solution to achieve this, and I don’t know any other programming languages, so I’ve decided to stick with my colab and drop the GDS integration. You are welcome to experiment with it yourself with Ruth and Hülya‘s codebase.
Conclusion: Leaving GTrends in GDS to the pros. Over & out.
Quick note: I just remembered having a go at a Google Trends GDS connector developed by StrategiQ. This connector (which is free and you just get an API key from them and you’ll be able to connect), is great for visualising the trend of a specific keyword or several ones. However, I wasn’t able to find information on using this connector for related keywords. Definitely worth a shot if this information is what you’re looking for.
Enter Streamlit: A Quick Beginners Guide
The colab was working, non-coders/non-seos were happy, but I was not. There was a new & shiny Python toy in town, often showcased by the works of Charly Wargnier, that I had a gut feeling that would be perfect to get me to where I want to be: The simplest (sexy) and most user-friendly way to get your Google Trends Related Keywords data, no coding required (from the end user), and that toy is called:
So what is Streamlit?
Streamlit is the most user-friendly way to visualise your python data and the fastest way to build and share data apps. Charly has been one of their biggest supporters, and his slick work on this platform made me extremely excited to work on it.
In simpler terms, Streamlit is actually a beautiful python library (installed from your terminal via pip install streamlit), that comes with a variety of nifty features, as you can see on this cheatsheet by user daniellewisDL, to turn your boring dark-mode python code output into a beautiful web app to display on your browser/on the web, instead of on the terminal window.
Charly has been incredibly helpful with quite a few tweaks on my app and getting me access to Streamlit Sharing, which is what you need in order to deploy apps publicly. Thank you, Streamaster🐍🔥
How to get started with Streamlit from scratch? (Python knowledge required)
- From your terminal window, install the Streamlit library by running pip install streamlit or pip3 install streamlit, whatever works for you.
- To make sure this worked, on your terminal window, run the command streamlit hello.
- This will appear on your terminal window, and a new tab with some Streamlit demos (more important than you might think) will appear. If a tab does not open, just paste one of these addresses into a new tab on your browser
- The tab that just opened locally contains awesome demos that are an excellent way to get started. Each of the 4 demos include code below, that you can copy & save on a py file and then run them in your terminal with the
streamlit run <file-name>.py to play around with the code.
- Just edit/add some of the commands in this cheatsheet and see what it changes. This is how it looks like:
- To keep learning from there, go to the Streamlit Gallery, where you have sample apps & components (which where I learned the most from) and though the bad news is that no, you can’t skip the documentation (I’m saying “bad news” because I’m more of a tl;dr person and I love cheatsheets). But the good news is that the Streamlit documentation is as clear, beautiful and user-friendly as the apps you can create with it. I wish they were all like this.
- The Streamlit community is also really helpful when you get stuck.
- Hot tip: Follow Charly on Twitter for tips and new Streamlit projects. Check out his Stream-lit portfolio here🐍🔥
- Make sure you have a GitHub username before you sign up to Streamlit
- Request a Streamlit share access in order to deploy your app right away. This takes times to get approved, so make sure to do that right away as you play around.
- As mentioned above, you’ll need Streamlit share access to deploy your app. In short, the way you deploy is by hosting your repo to GitHub and then deploying on that GitHub repo from Streamlit from here:
So without further ado, fast forward to me learning a tonne on my own and from from my pythonista friends, my solution is now ready, exactly the way I wanted😃. Drumroll please:
Introducing The Solution (V2): The G-Trendalyser (Free SEO tool, No coding required)
Just like a good recipe site, I left the best to the end (but I did provide a table of contents for you to get directly to this point, so in case you used it to get here, you missed a killer cheesecake recipe!😉 just kidding). Here you go!
How it works:
- Type/paste your keywords (up to 5)
- Choose your country (geo)
- Choose your timeframe
- Hit ‘Get Trends’ at the bottom
Voilà! You’ve got your related trending keywords!
Please note that the values do not represent search volumes, but these are more of an indication of how trendy the query is compared to others on that list.
But wait… there’s more! Get my repo here
If you’re a python dev and you want to for this repository to have a little play, go to my GitHub Repository here