sst_rt_positions_history: Get ranking history for the domain or URL in selected search...

View source: R/rank_tracker.R

sst_rt_positions_historyR Documentation

Get ranking history for the domain or URL in selected search region

Description

This method method returns the rankings for specified domain is selected search region.

Usage

sst_rt_positions_history(
  api_token,
  project_id,
  region_id,
  date_from = Sys.Date() - 8,
  date_to = Sys.Date() - 1,
  keywords = NULL,
  url = NULL,
  sort = "keyword",
  order = "desc",
  page = 1,
  size = 100,
  return_method = "list"
)

Arguments

api_token

(required) Serpstat API token from your profile.

project_id

(required) The ID of your project in Serpstat. You can find this ID in the URL of any rank tracker report. As an example, in https://serpstat.com/rank-tracker/keywords/12345/positions?get_params the ID would be 12345.

region_id

(required) The ID of a region returned by sst_rt_project_regions.

date_from

(optional) The date string in 'YYYY-MM-DD' format to specify the initial date of retrieved data. Default value is current date minus 8 days.

date_to

(optional) The date string in 'YYYY-MM-DD' format to specify the final date of retrieved data. Must not exceed date_from + 30 days. Default is yesterday.

keywords

(optional) A vector of keywords for witch the data should be retrieved. Maximum 1000 keywords per request. By default all the data for all keywords in the project is returned.

url

(optional) The domain name (e.g. domain.com) or web page address (e.g. https://domain.com/page) to get the data for. By default the results are returned for the projects' domain name.

sort

(optional) Must be one of 'keyword' (default) to sort the results alphabetically or 'date' to sort the results by date.

order

(optional) The sorting order. Must be one of string 'desc' (default) for descending sorting or 'asc' for ascending sorting.

page

(optional) Response page number if there are many pages in response. The default value is 1.

size

(optional) Response page size. Must be one of 20, 50, 100, 200, 500.The default value is 100.

return_method

(optional) Accepted values are 'list' (default) to return data object as list or 'df' to return data object as data.frame.

Value

Returns positions of selected domain in search engine results in selected region with corresponding URLs for these positions.

API docs

Check all the values for request and response fields here.

API rows consumption

0

Examples

## Not run: 
api_token <- Sys.getenv('SERPSTAT_API_TOKEN')
project_id <- 12345
region_id  <- sst_rt_project_regions(
  api_token  = api_token,
  project_id = project_id
  )$data$regions[[1]]$id
sst_rt_positions_history(
  api_token     = api_token,
  project_id    = project_id,
  region_id     = region_id,
  date_from     = '2020-12-01',
  date_to       = '2020-12-30',
  keywords      = c('seo', 'ppc', 'serpstat'),
  url           = 'serpstat.com',
  sort          = 'keyword',
  order         = 'desc',
  page          = 1,
  size          = 100,
  return_method = 'list'
)

## End(Not run)

serpstatr documentation built on Sept. 9, 2023, 5:06 p.m.