Export additional metrics about the target, such as total number of referring domains, referring class C networks and referring IP addresses.
rah_metrics_extended(target, token = Sys.getenv("AHREFS_AUTH_TOKEN"),
mode = "domain", metrics = NULL, limit = 1000, order_by = NULL,
where = NULL, having = NULL)
character string. Aim of a request: a domain, a directory or a URL
character string. Authentication token. Should be available through enviromental variables
after authentication with function rah_auth()
character string. Mode of operation: exact, domain, subdomains or prefix. See more in Details section
character vector of columns to select. See more in Details section
integer. Number of results to return
character vector of columns to sort on. See more in Details section
character string - a condition created by rah_condition_set()
function that generates proper
"where"
condition to satisfy. See more in Details section
character string - a condition created by rah_condition_set()
function that generates proper
"having"
condition to satisfy. See more in Details section
data frame
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 |
backlinks | int | - | - | Number of external backlinks found on the referring pages that link to the target. |
refpages | int | - | - | Number of external web pages containing at least one backlink that links to the target. |
pages | int | - | - | Number of unique pages visited by the Ahrefs crawler on the target. |
valid_pages | int | - | - | Number of unique pages with non 5xx HTTP code, visited by the Ahrefs crawler on the target. |
text | int | - | - | Number of backlinks that use anchor texts. |
image | int | - | - | Number of backlinks that use image as an anchor. |
nofollow | int | - | - | Number of NoFollow backlinks that link to the target. |
dofollow | int | - | - | Number of DoFollow backlinks that link to the target. |
redirect | int | - | - | Number of redirects found that forward to the target. |
canonical | int | - | - | Number of canonical backlinks that link to the target. |
alternate | int | - | - | Number of alternate backlinks that link to the target. |
gov | int | - | - | Number of backlinks of all types (including images and NoFollow) found on web pages on governmental domains that link to the target. |
edu | int | - | - | Number of backlinks of all types (including images and NoFollow) found on web pages on educational domains that link to the target. |
rss | int | - | - | Number of RSS external links from the target. |
html_pages | int | - | - | Number of HTML pages the target link has. |
links_internal | int | - | - | Number of internal links found in the target. |
links_external | int | - | - | Number of external links found in the target. |
refdomains | int | - | - | Number of domains containing at least one backlink that links to the target. |
refclass_c | int | - | - | Number of referring class C networks that link to the target. |
refips | int | - | - | Number of distinct IP addresses under a single network that link to the target. |
2. "mode"
parameter can take 4 different values that will affect how the results will be grouped.
Example of URL directory with folder:
Example URL: ahrefs.com/api/
exact: ahrefs.com/api/
domain: ahrefs.com/*
subdomains: *ahrefs.com/*
prefix: ahrefs.com/api/*
Example of URL directory with subdomain:
Example URL: apiv2.ahrefs.com
exact: apiv2.ahrefs.com/
domain: apiv2.ahrefs.com/*
subdomains: *apiv2.ahrefs.com/*
prefix: apiv2.ahrefs.com/*
3. "order_by"
parameter is a character string that forces sorting of the results. Structure:
Structure: "column_name
:asc|desc"
Single column example: "first_seen:asc" ~ this sorts results by first_seen
column in ascending order
Multi column example: "last_seen:desc,first_seen:asc" ~ this sorts results
by 1) last_seen
column in descending order, and next by 2) first_seen
column in
ascending order
4. "where"
& "having"
are EXPERIMENTAL parameters of condition sets
(character strings) that control filtering the results. To create arguments:
use rah_condition()
function to create a single condition, for example:
cond_1 <- rah_condition(column_name = "links", operator = "GREATER_THAN", value = "10")
use rah_condition_set()
function to group single conditions into final condition
string, for example: fin_cond <- rah_condition_set(cond_1, cond_2)
provide final condition to proper report function as a parameter, for example:
RAhrefs::rah_metrics_extended(target = "ahrefs.com", token = "0123456789",
mode = "domain", metrics = NULL, limit = 1000, where = fin_cond, order_by = "first_seen:asc")
Other Ahrefs reports: rah_ahrefs_rank
,
rah_anchors_refdomains
,
rah_anchors
,
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
,
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
# NOT RUN {
# downloading
b <- RAhrefs::rah_metrics_extended(
target = "ahrefs.com",
limit = 2,,
order_by = "backlinks:desc")
# }
Run the code above in your browser using DataLab