Skip to content

Instantly share code, notes, and snippets.

View SiegHartR's full-sized avatar

Nicolino David Oppes SiegHartR

View GitHub Profile
@SiegHartR
SiegHartR / GAviewID_GTM_URL.R
Last active July 7, 2017 12:37
Find the desired GA view ID for your API call with only the URL of the page going through GTM - the aim is mainly to avoid any search into your accounts especially if you have to many property IDs and all with the same site url
library(httr)
library(XML)
library(googleAnalyticsR)
library(googleAuthR)
gwt_site_url <- "https://www.example.co.uk/"
html <- GET(gwt_site_url)
doc <- htmlParse(html)
library(googleAuthR)
library(googleAnalyticsR)
library(tidyverse)
library(bigQueryR)
library(rvest)
library(lubridate)
# Last Financial Week
end_date <- floor_date(Sys.Date(),"week") - 1
start_date <- end_date - 6