小编Cor*_*ory的帖子

Google Analytics Embed API:设置选择器显示默认值

我正在使用 Google Analytics Embed API。下面是我正在使用 Google 开发页面的代码示例。有没有办法设置选择器的默认值?账户 | 物业 | 看法

<!doctype html>
<html lang="en">
    <head>
    <title>Google Charts</title>
        <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>

        <script>
        gapi.analytics.ready(function() {
        var ACCESS_TOKEN = 'xxxxx'; // obtained from your service account

        gapi.analytics.auth.authorize({
            serverAuth: {
            access_token: ACCESS_TOKEN
            }
        });


        /**
           * 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 …
Run Code Online (Sandbox Code Playgroud)

google-analytics google-analytics-api

5
推荐指数
1
解决办法
4324
查看次数