domain_reports: Request SEMRush Domain Reports

Description Usage Arguments Value Examples

View source: R/domain_reports.R

Description

This function creates a request to the SEMRush SEO database for users with a subscription and sufficient API units.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
domain_reports(
  type,
  key,
  domain,
  domains,
  database = "us",
  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_organic', 'domain_adwords', 'domain_adwords_unique', 'domain_adwords_adwords', 'domain_adwords_historical', 'domain_domains', 'domain_shopping', 'domain_shopping_unique', 'domain_shopping_shopping', 'domain_organic_unique', and 'domain_organic_subdomains'.

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).

domains

vector. A vector of strings for each domain name that contains domains in a specified format, separated by "|". This format requires a domain to consist of <sign>|<type>|<domain>, where the <sign> means possible operations: "+", "-", "*", "/"; <type> has to take the value of "or" for organic keywords or "ad" for paid keywords; and( <domain> indicates a domain.

database

string. A regional database. If this parameter is not specified (i.e., ""), your request will be sent to all regional databases. 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.

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

## Request example for domain_domains

#define 'domains' argument (see https://www.semrush.com/api-analytics/#domain_domains)
domains <- "*|or|nike.com|*|or|adidas.com|*|or|reebok.com"

#Use function to request report
report <-
domain_reports(
  type = "domain_domains",
  key = key,
  domains = domains,
  database = "us",
  export_columns = c("Ph", "Nq", "Kd", "Co")
)

print(report)
# A tibble: 5 x 4
 Keyword          Search.Volume Keyword.Difficulty Competition
 <chr>                    <int>              <dbl>       <dbl>
1 shoes                  1500000               90.3        1   
2 basketball shoes        368000               89.8        1   
3 women                   368000               87.1        0.12
4 man                     301000               87          0   
5 shoes for men           301000               90.2        1

## End(Not run)   

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