我要链接并查看与Google Adwords链接的分析帐户。
使用的程序:
脚本:
exibble %>%
mutate(fruit = c('durian', 'coconut', 'banana', 'apricot', 'honeydew', 'grapefruit', 'fig', NA)) %>%
mutate(currency = c('65100.000', '1.390', '17.950', '49.950', '0.440', NA, '13.255', '1325.810')) %>%
select(group, fruit, currency) %>%
gt(groupname_col = 'group', rowname_col = 'fruit')
所需结果:与adwords帐户关联的分析帐户列表。
答案 0 :(得分:2)
您缺少Google Analytics(分析)中管理实体的作用域,请查看此https://developers.google.com/identity/protocols/oauth2/scopes#analytics
请使用“ https://www.googleapis.com/auth/analytics.edit”更新您的范围
我建议的更新:
function googleAuth(){
if (!empty($code)) {
--------------
---- Your existing script ----
--------------
} else {
if (!empty($id)) {
header("Location:https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=" . Configure::read('GOOGLE_OAUTH_CLIENT_ID') . "&redirect_uri=" . Configure::read('GOOGLE_OAUTH_REDIRECT_URI') . "&access_type=offline&approval_prompt=force&state=" . $id . "&scope=https://www.googleapis.com/auth/adwords%20https://www.googleapis.com/auth/analytics%20https://www.googleapis.com/auth/analytics.edit");
exit;
}
}
}
参考网址: https://developers.google.com/identity/protocols/oauth2/scopes#analytics