使用Google Analytics API的区域图-未采集类型错误无法读取'库'的未定义
Area Charts Using Google Analytics API - Uncaught TypeError Cannot Read 'libraries' of undefined
我正在使用Google Analytics Embed API在我们的网站上放置自定义分析。我已经成功地在我们的网站上授权了API,并创建了许多折线图和饼图。我现在正试图制作一个面积图来显示一些数据,但我一直收到同样的错误,我不知道为什么。我得到的错误是:
Uncaught TypeError: Cannot read property 'libraries' of undefined
根据我的理解,通常未定义意味着缺少某些东西,在这种情况下,我认为库。然而,我不确定如何或为什么。
我正在加载API使用:
<script async src="https://www.google-analytics.com/analytics.js"></script>
我创建面积图的脚本如下:
<script>
(function(w,d,s,g,js,fs){
g=w.gapi||(w.gapi={});g.analytics={q:[],ready:function(f){this.q.push(f);}};
js=d.createElement(s);fs=d.getElementsByTagName(s)[0];
js.src='https://apis.google.com/js/platform.js';
fs.parentNode.insertBefore(js,fs);js.onload=function(){g.load('analytics');};
}(window,document,'script'));
gapi.analytics.ready(function() {
/**
* Authorize the user with an access token obtained server side.
*/
gapi.analytics.auth.authorize({
'serverAuth': {
'access_token': '##############################################'
}
});
var primaryChart = new gapi.analytics.googleCharts.DataChart({
query: {
ids: 'ga:79361233',
metrics: 'ga:sessions',
dimensions: 'ga:browser',
'start-date': '2016-04-04',
'end-date': '2016-05-03'
},
chart: {
container: 'primaryChart',
type: 'AREA',
options: {
isStacked: true,
width: '100%',
height: '200',
tooltip: {
trigger: 'focus'
}
}
}
});
primaryChart.execute();
});
</script>
我对Line和Pie图表使用相同的设置,它们只是分别使用Line或Pie作为图表部分中的类型参数。然而,这些都奏效了。我已经搜索过了,除了Google的Chart API上的信息之外,我很难找到任何东西,因为我直接查询Analytics API,这与我使用的设置有点不同。
感谢您的帮助。
根据:内置组件参考CCD_ 1唯一支持的值是:行、列、栏、表和GEO请注意,这些值区分大小写,即使拼写正确。
相关文章:
- 同样,同样的错误'ahorcado.js:26未捕获类型错误:无法读取属性'beginPath'
- 未捕获的类型错误:无法读取属性'删除'的未定义
- 未捕获的类型错误:无法读取属性'name'即使它存在,也无法定义
- 看到“;未捕获的类型错误:无法读取属性'weight'未定义的“;尽管按照字面上的指示
- Soundcloud api"未捕获的类型错误:无法读取属性'uri'“未定义”;
- 未捕获的类型错误:无法读取属性'addEventListener'的null chrome扩展名
- 未捕获的类型错误:无法读取属性'状态'在react中为null
- 未捕获的类型错误:无法读取属性'中止'的未定义
- Javascript未捕获类型错误:无法读取属性'0'的未定义
- jQuery控制台错误:无法读取属性'top'的未定义
- 未捕获的类型错误: 无法读取未定义的属性“图像”
- 我该如何解决这个问题?“未捕获的类型错误:无法读取 null 的属性'appendChild'”
- json-api和错误结果:无法读取属性'长度'的未定义
- VM5111:1249未捕获类型错误:无法读取属性'x'为null
- 未捕获的类型错误:无法读取属性'道具'reactJS中未定义的
- 类型错误:无法读取未定义的属性“toString” - 为什么
- 未捕获的语法错误:读取JSON文件时出现意外的标记
- if, else if, and else"我的代码条件被错误读取
- 401未经授权的错误读取Azure移动服务表作为认证的用户(Javascript)
- node.js错误:读取ECONNRESET