未设置或未调整自定义指标

时间:2016-09-19 14:24:36

标签: javascript google-analytics

这是创建我的跟踪器并添加指标的代码:

ga('create', 'UA-xxxxx-x', 'none');
  var metricValue = 123;
  ga('set', 'metric1', metricValue);
  ga('send', 'pageview');

包含帖子的代码:

function queryReports() {
            gapi.client.request({
                path: '/v4/reports:batchGet',
                root: 'https://analyticsreporting.googleapis.com/',
                method: 'POST',
                body: {
                    reportRequests: [
                        {
                            viewId: VIEW_ID,
                            dateRanges: [
                                {
                                    startDate: '2015-08-19',
                                    endDate: '2016-09-19'
                                }
                            ],
                            metrics: [
                                { expression: "ga:pageviews" },
                                { expression: "ga:timeOnPage" },
                                { expression: "ga:exitRate" },
                                { expression: "ga:pageLoadTime" },
                                { expression: "ga:goal1ConversionRate" },
                                { expression: "ga:goal2ConversionRate" },
                                { expression: "ga:metric1" },
                                { expression: 'ga:sessions'}
                            ] 
                }
            ]
        }
        }).
        then(displayResults, console.error.bind(console));
        }

        function displayResults(response) {
            var formattedJson = JSON.stringify(response.result, null, 2);
            document.getElementById('query-output').value = formattedJson;
        }

除了自定义指标中的数据外,我正确接收所有数据。我也没有得到指标没有提升的错误,所以它似乎被重新认识。我做错了什么或遗忘了什么?

0 个答案:

没有答案