Last active
December 22, 2016 22:26
-
-
Save ryanpraski/8421e125f51278ba476d9f30a4510c49 to your computer and use it in GitHub Desktop.
Google Analytics Reporting API v4 pivot table functionality example for googleAnalyticsR. This code is for Google Analtyics page scroll depth reporting. See the blog post here: http://www.ryanpraski.com/scroll-depth-tracking-analysis-with-google-analytics-r/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## filter pivot results | |
pivot_dim_filter1 <- dim_filter("eventLabel", | |
"REGEXP", | |
"%|#disqus") | |
pivot_dim_clause <- filter_clause_ga4(list(pivot_dim_filter1)) | |
pivme <- pivot_ga4("eventLabel", | |
metrics = c("totalEvents"), | |
maxGroupCount = 5, | |
dim_filter_clause = pivot_dim_clause) | |
pivtest1 <- google_analytics_4(my_id, | |
c("2016-01-30","2016-12-20"), | |
metrics = c('totalEvents'), | |
dimensions = c('pagePath'), | |
filtersExpression = c("ga:eventLabel=~%|#disqus"), | |
anti_sample = TRUE, | |
pivots = list(pivme)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment