問題描述
谷歌分析:在我的網站上顯示數據時,我可以使用自定義維度名稱而不是索引嗎 (Google analytics : Can I use custom dimension name instead of index while showing data on Report On my Site)
我正在使用 Google Analytics API 來顯示數據。但是我的自定義維度數據會將標題顯示為
但我希望將表頭視為 SchoolName 或其他名稱,而不是自定義維度 3。
gapi.analytics.auth.authorize({ 'serverAuth': { 'access_token': token } });
var dataChart = new gapi.analytics.googleCharts.DataChart({
query: {
'ids': 'ga:111090746',
metrics: 'ga:totalEvents',
dimensions: dimension,
'start‑date': '30daysAgo',
'end‑date': 'yesterday',
'filters': 'ga:eventAction==' + filter,
'max‑results': maxSize,
output: 'dataTable',
'totalResults': 'integer',
},
chart: {
container: 'declare‑career‑container',
type: 'TABLE',
options: {
showRowNumber: true,
page: 'enable',
pageSize: '10',
sortColumn: 0,
sortAscending: false,
'width': 650,
'height': 400,
'headerRow': 'header',
}
}
});
dataChart.on('success', function (response) {
var lbl = document.getElementById('totalCount');
lbl.textContent = response.response.totalResults;
});
dataChart.execute();
我怎樣才能做到這一點?
參考解法
方法 1:
You need to add the user defined column in your google analytics account
- Sign in to your Google Analytics account.
- Select the Customization tab, at the top of any page in Analytics.
- Select Custom Reports in the left navigation.
- Your reports will be listed in the left navigation under Custom Reports.
- If no custom reports have been created, you will only see an entry for Overview under Custom Reports.
reference: https://support.google.com/analytics/answer/1033013
(by Sparsh Kumar Saxena、PauAI)