4

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.

ismirsehregal
  • 30,045
  • 5
  • 31
  • 78
Manu
  • 1,070
  • 10
  • 27
  • 2
    I see, you added the third bounty hoping for an answer. Unfortunately, it is hard for us, to reproduce this problem. Perhaps you can find a way to make your example code more reproducible for us (in a way, that when we copy it we get the same error message). Just from looking at it I'd assume it is a authentification issue. – Steffen Moritz Sep 09 '20 at 18:45
  • I agree with Steffen, it's very difficult to help. Maybe you could either directly ask the question in the [github issues](https://github.com/MarkEdmondson1234/googleAuthR/issues) or in their [slack team](https://docs.google.com/forms/d/e/1FAIpQLSerjirmMpB3b7LmBs_Vx_XPIE9IrhpCpPg1jUcpfBcivA3uBw/viewform). Don't forget to afterwards post the answer here – starja Sep 09 '20 at 20:10
  • 2
    possibly helpful https://stackoverflow.com/a/11485644/1563960 – webb Sep 11 '20 at 09:40

0 Answers0