backlinks_reports: Request SEMRush Backlinks Reports

Description Usage Arguments Value Examples

View source: R/backlinks_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
13
backlinks_reports(
  type,
  key,
  target,
  targets,
  target_type,
  target_types,
  display_limit = 5,
  display_offset,
  export_columns,
  timespan = "weeks",
  return_url = FALSE
)

Arguments

type

string. The report type to be generated. Available report types are "backlinks_overview",'backlinks','backlinks_refdomains', 'backlinks_refips', 'backlinks_tld', 'backlinks_geo', 'backlinks_anchors', 'backlinks_pages', 'backlinks_competitors', 'backlinks_matrix', 'backlinks_comparison', 'backlinks_ascore_profile', 'backlinks_categories_profile', 'backlinks_categories', or 'backlinks_historical'.

key

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

target

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

targets

vector. A vector of items (character strings), where an item is a root domain, domain or URL. Formatting: targets[]=example.com&targets[]=www.example.com&targets[]=http://www.example.com.

target_type

string. A type of requested target, one of 'root_domain', 'domain', or 'url'.

target_types

vector. A vector of items (character strings), where an item is a type of requested target specified in the parameter "targets[]". Formatting: target_types[]=root_domain&target_types[]=domain&target_types[]=url.

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.

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.

timespan

string. One of 'weeks' or 'months'. Weeks - returns weekly historical dates over the period of last six months, so 27 lines maximum (if display_limit isn’t specified; otherwise returns number of most recent weekly historical dates specified in display_limit). Months - returns monthly historical dates over all the available historical period (if display_limit isn’t specified; otherwise returns number of most recent monthly historical dates specified in display_limit). Default: weeks

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

##Get 'backlinks_overview' report
backlinks_reports(
  type = "backlinks_overview",
  target = "cran.r-project.org",
  key = key,
  target_type = "domain",
  return_url = FALSE
)

##Get 'backlinks_comparison' report
backlinks_reports(
  type = "backlinks_comparison",
  targets = c("cran.r-project.org", "cran.r-project.org"),
  key = key,
  target_types = c("root_domain", "domain"),
  return_url = FALSE
)

## End(Not run)

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