Description Usage Arguments Details Value Examples
View source: R/lh_simple_2_vec.R
This function can check multiple URLs given in a vector and parse them into a one data frame. This data frame doesn't contain all the possible information from Pagespeed as response cannot be simply parsed into tabular form, but it contains most of the metrics, recommendations and error occurences.
1 2 3 4 | lh_simple_2_vec(url, key = Sys.getenv("PAGESPEED_API_KEY"),
strategy = NULL, categories = "performance", long_result = TRUE,
interval = 0.5, locale = NULL, utm_campaign = NULL,
utm_source = NULL)
|
url |
vector of character strings. The URLs to fetch and analyze |
key |
string. Pagespeed API key to authenticate. Defaults to "PAGESPEED_API_KEY" enviroment variable |
strategy |
string. The analysis strategy to use. Options: "desktop" or "mobile". Defaults to "desktop" |
categories |
string. A Lighthouse category/categories to run. Defaults to "performance". See more in Details section |
long_result |
logical. Should the resulting data frame be a long df? |
interval |
numeric. Number of seconds to wait between multiple queries. Defaults to 0.5 second |
locale |
string. The locale used to localize formatted results |
utm_campaign |
string. Campaign name for analytics. Defaults to NULL |
utm_source |
string. Campaign source for analytics. Defaults to NULL |
This function uses new version of the API (5th).
Check function ps_simple_2_vec()
for version 4
(classic Pagespeed results).
If you need all the information but in form of a nested list,
use lh_raw_2_vec()
.
Mind that resulting data frame can have
literally hundreds/thousands of columns (depending on how many
categories
were selected). This is due to large amount of data returned by
Lighthouse reports.
formatted data frame
1 2 3 4 | ## Not run:
multiple_urls_simple_output <- lh_simple_2_vec("https://www.google.com/")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.