简体   繁体   English

Google Analytics(分析)信息中心响应无效

[英]Google analytics dashboard response not valid

I want to create a google analytics dashboard with multiple views on my site, but I have a problem. 我想创建一个在网站上具有多个视图的Google Analytics(分析)信息中心,但出现问题。 I followed all the instructions on https://ga-dev-tools.appspot.com/embed-api/basic-dashboard/ for the first test. 对于第一个测试,我遵循了https://ga-dev-tools.appspot.com/embed-api/basic-dashboard/上的所有说明。

This is the code 这是代码

<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
</head>
<body>
<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'));
</script>

<div id="embed-api-auth-container"></div>
<div id="chart-container"></div>
<div id="view-selector-container"></div>

<script>

    gapi.analytics.ready(function () {

        /**
         * Authorize the user immediately if the user has already granted access.
         * If no access has been created, render an authorize button inside the
         * element with the ID "embed-api-auth-container".
         */
        gapi.analytics.auth.authorize({
            container: 'embed-api-auth-container',
            clientid: 'MYCLIENTID.apps.googleusercontent.com'
        });


        /**
         * Create a new ViewSelector instance to be rendered inside of an
         * element with the id "view-selector-container".
         */
        var viewSelector = new gapi.analytics.ViewSelector({
            container: 'view-selector-container'
        });

        // Render the view selector to the page.
        viewSelector.execute();


        /**
         * Create a new DataChart instance with the given query parameters
         * and Google chart options. It will be rendered inside an element
         * with the id "chart-container".
         */
        var dataChart = new gapi.analytics.googleCharts.DataChart({
            query: {
                metrics: 'ga:sessions',
                dimensions: 'ga:date',
                'start-date': '30daysAgo',
                'end-date': 'yesterday'
            },
            chart: {
                container: 'chart-container',
                type: 'LINE',
                options: {
                    width: '100%'
                }
            }
        });


        /**
         * Render the dataChart on the page whenever a new view is selected.
         */
        viewSelector.on('change', function (ids) {
            dataChart.set({ query: { ids: ids } }).execute();
        });

    });
</script>

</body>
</html>

The response from the file: https://accounts.google.com/o/oauth2/iframerpc?action=checkOrigin&origin=http%3A%2F%2Fecommerce.tredweb.com&client_id=MYCLIENTID.apps.googleusercontent.com is always {"valid":false} , but the origin on the google developer console, is already authorized for my site in the project. 来自文件的响应: https : //accounts.google.com/o/oauth2/iframerpc?action=checkOrigin&origin=http%3A%2F%2Fecommerce.tredweb.com&client_id=MYCLIENTID.apps.googleusercontent.com始终为{"valid":false} (但google开发人员控制台上的来源已被授权用于该项目中我的网站)。 I don't understand where the problem is. 我不明白问题出在哪里。

确保您的出身完全是“ http://ecommerce.tredweb.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google Analytics for Shiny Dashboard App - Google Analytics for Shiny Dashboard App 如何翻译Google Analytics(分析)信息中心? - How to translate Google Analytics dashboard? Google Analytics _setCustomVar - 我的信息中心中的奇怪数据 - Google Analytics _setCustomVar - strange data in my dashboard 使用自定义日期创建Google Analytics(分析)信息中心 - Creating Google Analytics Dashboard With Custom Dates Google AnalyticsAPI - 获取信息中心的网页浏览量 - Google Analytics API - Get Pageviews for Dashboard Google Analytics:未检测到 HTTP 响应 - Google Analytics: No HTTP Response Detected 获取谷歌分析 Api 响应 - Get google analytics Api response Google Analytics API JavaScript显示数据而无需登录仪表板上的用户 - Google Analytics API JavaScript show data without login to users on dashboard Google Analytics(分析)仪表板AJAX函数未获取值 - Google Analytics Dashboard AJAX Function Does Not get values Google Analytics(分析)日期范围选择器/信息中心-如何针对自定义网络应用使用Google Analytics(分析)中的日期选择器? - Google Analytics date range picker / dashboard - How to use date picker present in Google Analytics for a custom web app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM