overview_reports: Request SEMRush Overview Reports

Description Usage Arguments Value Examples

View source: R/overview_reports.R

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
overview_reports(
  type,
  key,
  domain,
  database,
  display_limit = 5,
  display_offset,
  display_date,
  export_columns,
  display_daily,
  return_url = FALSE
)

Arguments

type

string. The report type to be generated. Available report types are 'domain_ranks','domain_rank','domain_rank_history','rank_difference', or 'rank'.

key

string. An identification key assigned to a user after subscribing to SEMrush. The key is available on the Profile page.

domain

string. A unique name of a website you would like to investigate (example.com).

database

string. A regional database. If this parameter is not specified (i.e., ""), your request will be sent to all regional databases.

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.

display_daily

integer. Only used for some report types. This parameter allows you to get daily updates on position changes that occurred in the last 30 days or more. If the parameter is not specified, your report will show monthly results for the current month and for previous months.

return_url

logical. If TRUE, prints the request URL used to generate the report. Default value is FALSE.

Value

A data table (tibble) with columns for each requested variable.

Examples

 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
#Enter your SEMRush account API key
## Not run: 
key <- ""

## Get 'domain_ranks' report for a single domain
report <- overview_reports(
  type = "domain_ranks",
  key = key,
  domain = "cran.r-project.org",
  display_limit = 5,
  export_columns = c("Db", "Dt", "Dn", "Rk")
)

print(report)
# A tibble: 5 x 4
Database     Date Domain          Rank
<chr>       <int> <chr>          <int>
1 ph       20200617 r-project.org   353
2 ge       20200617 r-project.org   906
3 kh       20200617 r-project.org   971
4 is       20200616 r-project.org  1019
5 ma       20200616 r-project.org  1034

## Get 'rank' report
report <- overview_reports(
  type = "rank",
  key = key,
  domain = "cran.r-project.org",
  database = "us", #United States
  display_limit = 5,
  export_columns = c("Dn", "Rk", "Or", "Ot")
)

print(report)
# A tibble: 5 x 5
 Keyword                    Position Previous.Position Search.Volume   CPC
 <chr>                         <int>             <int>         <int> <dbl>
1 cran                              1                 1          8100  1.42
2 r cran                            1                 1          5400  0   
3 r cran download                   1                 1           590  0   
4 cran r project org windows        1                 1           590  0   
5 cran r project                    1                 1           480  0   

## End(Not run)

ericvc/semRush documentation built on Aug. 7, 2020, 12:54 p.m.