rah_anchors: Export the anchor text and the number of backlinks, referring...

Description Usage Arguments Details Value Source See Also Examples

View source: R/rah_anchors.R

Description

Export the anchor text and the number of backlinks, referring pages and referring domains that has it.

Usage

1
2
3
rah_anchors(target, token = Sys.getenv("AHREFS_AUTH_TOKEN"),
  mode = "domain", metrics = NULL, limit = 1000, order_by = NULL,
  where = NULL, having = NULL)

Arguments

target

character string. Aim of a request: a domain, a directory or a URL

token

character string. Authentication token. Should be available through enviromental variables after authentication with function rah_auth()

mode

character string. Mode of operation: exact, domain, subdomains or prefix. See more in Details section

metrics

character vector of columns to select. See more in Details section

limit

integer. Number of results to return

order_by

character vector of columns to sort on. See more in Details section

where

character string - a condition created by rah_condition_set() function that generates proper "where" condition to satisfy. See more in Details section

having

character string - a condition created by rah_condition_set() function that generates proper "having" condition to satisfy. See more in Details section

Details

1. available metrics - you can select which columns (metrics) you want to download and which one would be useful in filtering, BUT not all of them can always be used in "where" & "having" conditions:

Column Type Where Having Description
anchor string + + Anchor text used in at least one backlink from the referring domain.
backlinks int + + Number of external backlinks found that are using the anchor text.
refpages int + + Number of pages found containing backlinks that are using the anchor text.
refdomain string + - Referring domain that contains at least one backlink using the anchor text.
refdomains int - + Number of referring domains that are using the anchor text when linking to the target.
first_seen date + + Least recent date when the Ahrefs crawler was able to visit the backlink that is using the anchor text.
last_visited date + + Most recent date when the Ahrefs crawler was able to visit the backlink that is using the anchor text.

2. "mode" parameter can take 4 different values that will affect how the results will be grouped.

Example of URL directory with folder:

Example of URL directory with subdomain:

3. "order_by" parameter is a character string that forces sorting of the results. Structure:

4. "where" & "having" are EXPERIMENTAL parameters of condition sets (character strings) that control filtering the results. To create arguments:

  1. use rah_condition() function to create a single condition, for example: cond_1 <- rah_condition(column_name = "links", operator = "GREATER_THAN", value = "10")

  2. use rah_condition_set() function to group single conditions into final condition string, for example: fin_cond <- rah_condition_set(cond_1, cond_2)

  3. provide final condition to proper report function as a parameter, for example: RAhrefs::rah_anchors(target = "ahrefs.com", token = "0123456789", mode = "domain", metrics = NULL, limit = 1000, where = fin_cond, order_by = "first_seen:asc")

Value

data frame

Source

https://ahrefs.com/api/documentation

https://ahrefs.com/api/documentation

See Also

Other Ahrefs reports: rah_ahrefs_rank, rah_anchors_refdomains, rah_backlinks_new_lost_counters, rah_backlinks_new_lost, rah_backlinks_one_per_domain, rah_backlinks, rah_broken_backlinks, rah_broken_links, rah_domain_rating, rah_linked_anchors, rah_linked_domains_by_type, rah_linked_domains, rah_metrics_extended, rah_metrics, rah_pages_extended, rah_pages_info, rah_pages, rah_refdomains_by_type, rah_refdomains_new_lost_counters, rah_refdomains_new_lost, rah_refdomains, rah_refips, rah_subscription_info

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
## Not run: 
# creating single conditions for 'where' parameter
# let's see anchors of all backlinks detected in 2018
cond_1 <- RAhrefs::rah_condition(
   column_name = "first_seen",
   operator    = "GREATER_OR_EQUAL",
   value       = "2018-01-01",
   is_date     = TRUE)

cond_2 <- RAhrefs::rah_condition(
   column_name = "first_seen",
   operator    = "LESS_OR_EQUAL",
   value       = "2018-12-31",
   is_date     = TRUE)

# joining conditions into one condition set
cond_where <- RAhrefs::rah_condition_set(cond_1, cond_2)

# downloading
b <- RAhrefs::rah_anchors(
  target   = "ahrefs.com",
  limit    = 2,
  where    = cond_where,
  order_by = "refpages:desc")

## End(Not run)

civitch/Doingbuzz-Ahrefs documentation built on Aug. 19, 2020, 12:06 a.m.