Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi.
I have written an R script to pull data from Google Analytics and I want to use the data frame created in R to be integrated in Power BI.
However, I am encountering this error-
"DataSource.Error: ADO.NET: R script error.
2018-09-03 12:00:25> Default Google Project for googleAnalyticsR is now set.
This is shared with all googleAnalyticsR users.
If making a lot of API calls, please:
1) create your own Google Project at https://console.developers.google.com
2) Activate the Google Analytics Reporting API
3) set options(googleAuthR.client_id) and options(googleAuthR.client_secret)
4) Reload the package.
2018-09-03 12:00:25> Set API cache
2018-09-03 12:00:25> No environment argument found, looked in GA_AUTH_FILE
Warning message:
package 'googleAnalyticsR' was built under R version 3.5.1
2018-09-03 12:00:26> Fetching v4 data batch...
Error : Authentication options didn't match existing session token and not interactive session
so unable to manually reauthenticate
Error in error_check(out) :
Authentication options didn't match existing session token and not interactive session
so unable to manually reauthenticate
Calls: google_analytics ... fetch_google_analytics_4 -> lapply -> FUN -> error_check
Execution halted
Details:
DataSourceKind=R
DataSourcePath=R
Message=R script error.
2018-09-03 12:00:25> Default Google Project for googleAnalyticsR is now set.
This is shared with all googleAnalyticsR users.
If making a lot of API calls, please:
1) create your own Google Project at https://console.developers.google.com
2) Activate the Google Analytics Reporting API
3) set options(googleAuthR.client_id) and options(googleAuthR.client_secret)
4) Reload the package.
2018-09-03 12:00:25> Set API cache
2018-09-03 12:00:25> No environment argument found, looked in GA_AUTH_FILE
Warning message:
package 'googleAnalyticsR' was built under R version 3.5.1
2018-09-03 12:00:26> Fetching v4 data batch...
Error : Authentication options didn't match existing session token and not interactive session
so unable to manually reauthenticate
Error in error_check(out) :
Authentication options didn't match existing session token and not interactive session
so unable to manually reauthenticate
Calls: google_analytics ... fetch_google_analy...
ErrorCode=-2147467259
ExceptionType=Microsoft.PowerBI.Radio.RScriptRuntimeException"
I have set the permissions for both- R and Google Analytics as public but still I am getting this error.
Following is the R script-
# 'dataset' holds the input data for this script
library(googleAnalyticsR)
library(ggplot2)
my_id <- 123456
start_date <- "2018-08-01"
end_date <- "2018-08-31"
dataset <- google_analytics(my_id, date_range = c(start_date, end_date),
metrics = c("transactions", "transactionRevenue", "transactionShipping", "transactionTax", "totalValue", "itemQuantity"),
dimensions = c("date", "channelGrouping", "sourceMedium", "transactionID", "orderCouponCode"), max= 200000 )
#View(dataset)
Kindly guide on how to get rid of this error.
Hi @ayush
I'm having problem when connecting the Google Analytics and Power BI using R but when I wrote an R script to connect it to smartly.io, then there was no issue.
Once I resolve the authentication issue of GA, will let you know at once.
HI @aJ2,
It seems like you are faced with authentication error when you use R script with google analytics.
After check your script, I haven't found you invoke authentication functions in r script. If you can please add it to your formula.
In addition, you can also take a look at following links about R with google analytics api:
Google authentication types for R
Regards,
Xiaoxin Sheng
Hi @v-shex-msft,
Thanks for your reply.
So do I need to revoke the permissions first in the R script before executing the script in Power BI?
I had followed the last link in your reply to integrate Google Analytics with R and then when I tried integrating the same in Power BI, the error pops up.
HI @aJ2,
It seems like Google Analytics R package used web browser with oauth authorization which power bi not approve.
For this scenario, I'd like to suggest you use other authorization mode:
Google authentication types for R
Regards,
Xiaoxin Sheng
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
88 | |
63 |