Learn R Programming

RAhrefs (version 0.1.4)

rah_pages_info: Export additional info about the target, such as IP address, canonical URL, social meta tags and social metrics.

Description

Export additional info about the target, such as IP address, canonical URL, social meta tags and social metrics.

Usage

rah_pages_info(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

Value

nested list - the structure can be too complicated to convert into simple data frame

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
url string + + URL of the crawled page.
ip string + + IP address of the server that returned the page.
size int + + Size of the crawled page, in bytes.
links_internal int + + Number of internal links found in the crawled page.
links_external int + + Number of external links found in the crawled page.
encoding string + + Character encoding of the page, for example "utf8" or "iso-8859-1" (Latin-1).
title string + + Title of the crawled page.
redirect_url string + + URL where the page redirects to.
canonical_url string + + Canonical URL of the page.
content_encoding string + + Type of encoding used to compress the page data, for example "gzip" or "deflate".
description string + + Description of the crawled page.
meta_social string + + Contents of meta tags for social sharing sites.
twitter int + + Number of Twitter shares of the page.
pinterest int + + Number of Pinterest shares of the page.
facebook_likes int + + Number of Facebook likes of the page.
facebook_shares int + + Number of Facebook shares of the page.
facebook_comments int + + Number of Facebook comments of the page.
facebook_clicks int + + Number of Facebook clicks of the page.
facebook_comments_box int + + Number of Facebook box comments of the page.
facebook int + + Total number of Facebook shares/likes of the page.
total_shares int + + Total number of shares of the page across all social networks.

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:

  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_pages_info(target = "ahrefs.com", token = "0123456789", mode = "domain", metrics = NULL, limit = 1000, where = fin_cond, order_by = "first_seen:asc")

See Also

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_extended, rah_metrics, rah_pages_extended, rah_pages, rah_refdomains_by_type, rah_refdomains_new_lost_counters, rah_refdomains_new_lost, rah_refdomains, rah_refips, rah_subscription_info

Examples

Run this code
# NOT RUN {
# creating single conditions for 'where' parameter
cond_1 <- RAhrefs::rah_condition(
   column_name = "facebook_likes",
   operator    = "GREATER_OR_EQUAL",
   value       = "1000")

cond_2 <- RAhrefs::rah_condition(
   column_name = "facebook_shares",
   operator    = "GREATER_THAN",
   value       = "200")

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

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

Run the code above in your browser using DataLab