Description Usage Arguments Value Examples
View source: R/keyword_reports.R
This function creates a request to the SEMRush SEO database for users with a subscription and sufficient API units. See the SEMRush API website (https://www.semrush.com/api-analytics/) for additional information, including a list of codes for the regional databases and export variables.
1 2 3 4 5 6 7 8 9 10 11 | keyword_reports(
type,
key,
phrase,
database,
display_limit = 5,
display_offset,
display_date,
export_columns,
return_url = FALSE
)
|
type |
string. REQUIRED. The report type to be generated. Available report types are 'phrase_all', 'phrase_this','phrase_these','phrase_organic','phrase_adwords', 'phrase_related', 'phrase_adwords_historical', 'phrase_fullsearch', 'phrase_questions', or 'phrase_kdi'. |
key |
string. REQUIRED. An identification key assigned to a user after subscribing to SEMrush. The key is available on the Profile page. |
phrase |
string, vector. REQUIRED. A keyword or keyword expression you'd like to investigate. Also, a vector of character strings. |
database |
string. A regional database. If this parameter is not specified (i.e., ""), your request will be sent to all regional databases, if possible. Default is the United States. |
display_limit |
integer. The number of results returned to a request. If this parameter is set to 0, up to 10,000 lines will be returned. Default is 5 lines. |
display_offset |
integer. This parameter allows you to skip a specified number of results before sending a report. Please keep in mind that if you use the option display_offset, display_limit, the value should be increased by value display_offset. |
display_date |
string. Date in format "YYYYMM15". A date on which a report will be shown. You can roll back to the past or choose an actual date. |
export_columns |
vector. A vector of character strings specifying the variables to be included in the report, which vary according to the report type (see 'type' argument). If this parameter is not specified, default columns will be sent. |
return_url |
logical. If TRUE, prints the request URL used to generate the report. Default value is FALSE. |
A data table (tibble) with columns for each requested variable.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #Enter your SEMRush account API key
key <- ""
## Not run:
## Generate 'phrase_organic' report
report <- keyword_reports(
type = "phrase_organic",
key = key,
phrase = "r software",
database = "us",
display_limit=10,
export_columns = c("Dn","Ur")
)
print(report)
# A tibble: 10 x 2
Domain Url
<chr> <chr>
1 r-project.org https://www.r-project.org/
2 wikipedia.org https://en.wikipedia.org/wiki/R_(programming_language)
3 rstudio.com https://rstudio.com/
4 epa.gov https://archive.epa.gov/nheerl/arm/web/pdf/irss_2.6.pdf
5 umich.edu https://www.icpsr.umich.edu/icpsrweb/content/shared/ICPSR/faqs/what-~
6 datamentor.io https://www.datamentor.io/r-programming/
7 psu.edu https://online.stat.psu.edu/statprogram/tutorials/statistical-softwa~
8 utoledo.edu https://libguides.utoledo.edu/stats-software/R
9 statmethods.n~ https://www.statmethods.net/r-tutorial/index.html
10 statmethods.n~ https://www.statmethods.net/
## Generate 'phrase_these' report
report <- keyword_reports(
type = "phrase_these",
key = key,
phrase = c("statistical programming","r software","r programming"),
database = "us",
display_limit=10,
export_columns = c("Ph", "Nq", "Cp", "Nr")
)
print(report)
# A tibble: 3 x 4
Keyword Search.Volume CPC Number.of.Results
<chr> <int> <dbl> <dbl>
1 r programming 22200 4.36 266000000
2 r software 4400 5.87 4540000000
3 statistical programming 1000 3.91 407000000
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.