fetch_crb_traffic_public: Download traffic data for all Commons research briefing...

Description Usage Arguments Details Value

View source: R/commons-traffic.R

Description

fetch_crb_traffic_public downloads data on traffic metrics for all Commons Library research briefings during the given dates and returns the data as a tibble. These are the landing pages for briefings whose codes begin with "SN", "CBP" or "CDP".

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
fetch_crb_traffic_public(
  start_date,
  end_date,
  internal = FALSE,
  by_date = FALSE,
  by_page = FALSE,
  combine = FALSE,
  merge_paths = FALSE,
  anti_sample = FALSE,
  use_resource_quotas = FALSE
)

Arguments

start_date

The start date as an ISO 8601 string.

end_date

The end date as an ISO 8601 string.

internal

A boolean indicating whether to return only the results for traffic from internal parliamentary networks. The default is FALSE.

by_date

A boolean indicating whether to return the results broken down by date. The default is FALSE.

by_page

A boolean indicating whether to return the results broken down by page. The default is FALSE.

combine

A boolean indicating whether to combine the totals from different properties or to report them separately. Note that combining the traffic across properties can introduce errors in the number of users, as the same user may visit pages on different properties. The default is FALSE.

merge_paths

A boolean indicating whether to aggregate figures for all pages that have the same root path i.e. for all pages whose paths differ only by their query strings or internal anchors. This parameter is ignored if by_page is set to FALSE. Note that while merging paths is necessary for analysis of individual pages it can introduce errors in the number of users by page, as the same user may visit the same page through URLs with different query strings and anchors. The default value is FALSE.

anti_sample

A boolean indicating whether to use googleAnalyticsR's anti-sample feature, which chunks API calls to keep the number of records requested under the API limits that trigger sampling. This makes the download process slower but ensures that all records are returned. Only use this feature if you see that an API request triggers sampling without it. The default is FALSE.

use_resource_quotas

A boolean indicating whether to use the resource quotas in Parliament's Google Analytics account to prevent sampling. This is a faster and more effective way to disable sampling than using anti_sample, but using resource quotas consumes tokens from a limited daily quota. Use this when anti_sample still fails to prevent sampling or is taking too long. Note that using resource quotas takes precendence over anti-samping: if use_resource_quotas is TRUE anti_sample is automatically set to FALSE. The default is FALSE.

Details

Note that this is not all Commons research briefing traffic, as it does not include traffic to the research briefing pages on the Parliamentary intranet. Use fetch_crb_traffic_intranet to retrieve equivalent data for the Parliamentary intranet.

By default, traffic figures are reported separately for each website property in Google Analytics that contains some of the requested data. You can use the combine argument to optionally combine traffic figures so that each result appears only once with figures totalled across all relevant properties. This makes it easier to produce aggregate figures for traffic across a number of properties, but may introduce errors in the number of users, as the same user may visit pages on different properties.

Traffic figures can be requested by page. Google Analytics treats webpages requested with different query strings and section anchors as different pages in its traffic data. You can use the merge_paths argument to optionally sum the figures for pages with the same base path. This makes it easier to calculcate the total number of views each distinct page has received, but note that this may introduce errors in the number of users, as a user may visit the same page using URLs with different query strings and anchors.

If combine and merge_paths are both set to TRUE, rows for different properties are combined before paths are merged.

Value

A tibble of traffic metrics.


olihawkins/clga documentation built on Sept. 17, 2020, 7:19 a.m.