I want to make data from google analytics available to users through Flexdashboard deployed on AWS. It will help to mix with other data sources and create a funnel (from web visits to desired actions).
---
title: "Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
library(googleAnalyticsR)
library(googleAuthR)
library(searchConsoleR)
library(tidyverse)
```
dataset <- eventReactive(input$button_execute, {
date_start <- input$input_date_start
date_end <- input$input_date_end
ga_auth()
my_accounts <- ga_account_list()
my_id <- 123456
dataset <- google_analytics(my_id,
date_range = c(date_start,date_end),
metrics = c("sessions"),
dimensions = c("dayOfWeek","hour"),
anti_sample = FALSE)
})
But as you know, it only works for your own analysis and is not for production scripts. So I have to set a client.id and client.secret to make it work.
The intended users have their google company mail account. Ideally they can access the data through a login. So I tried this:
```
token <- callModule(googleAuth, "login")
dataset <- google_analytics(my_id,
date_range = c(date_start,date_end),
metrics = c("sessions"),
dimensions = c("dayOfWeek","hour"),
anti_sample = FALSE)
```
But it sends generates an error: Error: redirect_uri_mismatch
Please, can you suggest some guidance? It will be helpful for people who wants an easy path to deploy their findings using Google Analytics and R. I will be actively following this post. Thank you.