javascript - Google Analytics API viewSelector.execute() error -


i having troubles google analytics embeded api. try display basics charts. here following code tried imitate: https://www.raymondcamden.com/2015/06/10/quick-example-of-the-google-analytics-embed-api

the beginning ok because logged in. however, error occurs when call "viewselector.execute();".

the javascript error 'uncaught exception'. don't know why appears because have followed step step tutorial...

here code ( have replaced 'xxxxxxxxx.apps.googleusercontent.com' real client id) :

@{ viewbag.title = "progress"; layout = null; }  <script> if (typeof window.onerror == "object") {     window.onerror = function (err, url, line) {         alert('exdescription :' + line + ' |' + err + ' | ' + url);     }; }  </script>  <!doctype html> <html> <head> <title>embed api demo</title> </head> <body>  <!-- step 1: create containing elements. --> <p style="color:red">google </p>     <section id="auth-button"></section>     <section id="view-selector"></section>     <section id="timeline"></section> </br> </br>   <!-- step 2: load library. -->  <script>     (function (w, d, s, g, js, fjs) {         g = w.gapi || (w.gapi = {}); g.analytics = { q: [], ready: function (cb) { this.q.push(cb) } };         js = d.createelement(s); fjs = d.getelementsbytagname(s)[0];         js.src = 'https://apis.google.com/js/platform.js';         fjs.parentnode.insertbefore(js, fjs); js.onload = function () { g.load('analytics') };     }(window, document, 'script')); </script>  <script>     gapi.analytics.ready(function () {          // step 3: authorize user.          var client_id = 'xxxxxxxxx.apps.googleusercontent.com'          gapi.analytics.auth.authorize({             container: 'auth-button',             clientid: client_id,         });          // step 4: create view selector.          var viewselector = new gapi.analytics.viewselector({             container: 'view-selector'         });          // step 5: create timeline chart.          var timeline = new gapi.analytics.googlecharts.datachart({             reporttype: 'ga',             query: {                 'dimensions': 'ga:date',                 'metrics': 'ga:sessions',                 'start-date': '30daysago',                 'end-date': 'yesterday',             },             chart: {                 type: 'line',                 container: 'timeline'             }         });          // step 6: hook components work together.          gapi.analytics.auth.on('success', function (response) {             alert('viewselector success');             viewselector.execute();         });          viewselector.on('change', function (ids) {             alert('viewselector change',);             var newids = {                 query: {                     ids: ids                 }             }             timeline.set(newids).execute();         });     }); </script> </body> </html> 

please check attached image error.enter image description here

anyone knows error , how fix it? application asp.net mvc website. :)


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - VueJS2 and the Window Object - how to use? -