Keyword Rankings and Forecasting in SEO using Shiny
Previously, we’ve seen how R can be used to retrieve data from APIs such as Google Analytics. Often with data, you’ll conduct the same type of analysis repeatedly, using the same kind of code, for various projects. To make life easier, wouldn’t you want to build a front-end, so you can just plug in your numbers and get your analysis out? With something called Shiny, you can!
What is Shiny?
Shiny is an R package built by Rstudio. With a Shiny application there are two parts, the backend and the front-end. The backend is the Server part of the code. This is the backbone of your work and where your normal repetitive analysis would take place. The front-end section of the code is the UI file of your code. This is where you can build the visuals to be able to run those repetitive analyses. However, it is possible to combine these parts and build an application in one single file, or just build the UI into your backend.
Why should you use Shiny?
Consider this scenario, you’ve built some code that lets you regularly interact with APIs. But you always change one aspect of the code so it’s specific to the project you are working on, such as changing the Google Analytics View ID to get the correct view. With Shiny, you could build an application that calls the API automatically and get the View ID that you need, and then retrieve the data required with the press of a button. A more explicit example is using AWR. You can access their API to get your list of projects and ranking dates, then display them in your UI. This way, you can load up your application, choose the project and date that you want, and get the keyword rankings in the format you need.If that doesn’t convince you, how about SEO forecasting? You could build a front-end onto your forecasting code so that when it is required, you can just plug in your data, press Go, and speed up your analysis. Or even better, building the application so one of your colleagues can do the forecasting for themselves using the same methodology that you use. To go a step further, put your application on a server so it can easily be accessed without them having to use R.The first advantage of this is that it makes the whole process more efficient. You don’t have to open your code up and edit it. You’ve done it before, why do it again? A second advantage is that it brings reproducible and robust analyses to people who don’t need to build or even understand R code to be able to conduct an analysis in R. Third, you now have a process and methodology in place that can easily be referred to.
There’s so many possibilities with R that make it so powerful. We’ve previously seen that we can integrate R into our data extraction process using APIs, so that we can combine data extraction with data analysis. What Shiny brings to the table is that we can bring the data extraction and analysis process to people who don’t know statistics and data. This also allows the process of making an actionable decision, whether it is by someone who knows R or not, much more efficient.
- Use Shiny for extracting keyword rankings
- Use Shiny for SEO forecasting
- Use Shiny to performing data analysis
- Use Shiny to do anything!