sst_sa_domain_history: Domain history

View source: R/search_analytics.R

sst_sa_domain_historyR Documentation

Domain history

Description

Returns historical metrics for the domain with about two weeks between measurements.

Usage

sst_sa_domain_history(
  api_token,
  domain,
  se,
  sort = NULL,
  filters = NULL,
  page = 1,
  size = 100,
  during_all_time = TRUE,
  return_method = "list"
)

Arguments

api_token

(required) Serpstat API token from your profile.

domain

(required) Domain to get data for.

se

(required) Search engine alias (db_name) returned by sst_sa_database_info.

sort

(optional) A field to sort the response. See Sorting for more details.

filters

(optional) A list of filtering options. See Filtering for more details.

page

(optional) Response page number if there are many pages in response.

size

(optional) Response page size.

during_all_time

(optional) TRUE (default) for all the history, FALSE for year-to-date data.

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 a number of metrics for each date for the domain.

API docs

Check all the values for request and response fields here.

API credits consumption

1 per date in the response.

Sorting

You can sort the response using sort argument. It must be a list with a single named element. The name of the element must match one of parameters in response. The value of the element must be asc for ascending order and desc for descending order. For example, sort = list(ads = 'desc') would sort the response by ads parameter in descending order.

Filtering

To filter the results you can use filters argument. It must be a list of named elements. The name of the element must match one of the filtering parameters. See API docs for more details. For example, filters = list(queries_from = 0, queries_to = 10) would narrow the results to include only the keywords that have a search volume between 0 and 10.

Examples

## Not run: 
api_token <- Sys.getenv('SERPSTAT_API_TOKEN')
sst_sa_domain_history(
  api_token     = api_token,
  domain        = 'serpstat.com',
  se            = 'g_us',
  sort          = list(date = 'desc'),
  filters       = list(traff_from = 20000),
  page          = 2,
  size          = 10,
  return_method = 'df'
)$data

## End(Not run)

serpstatr documentation built on Sept. 11, 2024, 7:16 p.m.