This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
serp_kw_volume = function(keyword, region) | |
{ | |
base_url <- "https://api.semrush.com/" | |
## update with your own SEMRush API Key | |
query_params_2 = list(type = "phrase_all", key=api_key, phrase=keyword, | |
database=region) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# General-purpose data wrangling | |
#install.packages("tidyverse") | |
#install.packages("rvest") | |
#install.packages("rebus") | |
#install.packages("lubridate") | |
library(tidyverse) | |
library(httr) | |
# Parsing of HTML/XML files | |
library(rvest) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this code doesn’t run, it’s just a comment telling you the next line | |
# will be a function that multiplies a variable by itself | |
times_two <- function(x) { | |
x * 2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install.packages("googleAnalyticsR", dependencies = TRUE) | |
## setup | |
library(googleAnalyticsR) | |
## This should send you to your browser to authenticate your email. Authenticate with an email that has access to the Google Analytics View you want to use. | |
ga_auth() | |
## get your accounts | |
account_list <- ga_account_list() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##load libraries | |
library(tidyverse) | |
library(httr) | |
## first we'll build a function to get the top keywoord for a single URL. We'll need to hook into SEMRush's API Here | |
get_top_kw <- function(page) { | |
base_url <- "https://api.semrush.com/" |