title: Google Anlaytics Embed API demo not working
body: <p>I followed the steps from the webite below: <a href="https://developers.google.com/analytics/devguides/reporting/embed/v1/devguide#client-id" rel="nofollow">https://developers.google.com/analytics/devguides/reporting/embed/v1/devguide#client-id</a></p>
  
  <p>when I execute the code below I get the error message in my console
  I have maintained "localhost" in my Javascript domain when I created my client id.
  Can you pls advise? thanks </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Embed API Demo&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;!-- Step 1: Create the containing elements. --&gt;
  
  &lt;section id="auth-button"&gt;&lt;/section&gt;
  &lt;section id="view-selector"&gt;&lt;/section&gt;
  &lt;section id="timeline"&gt;&lt;/section&gt;
  
  &lt;!-- Step 2: Load the library. --&gt;
  
  &lt;script&gt;
  (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'));
  &lt;/script&gt;
  
  &lt;script&gt;
  gapi.analytics.ready(function() {
  
    // Step 3: Authorize the user.
  
    var CLIENT_ID = 'XXXXXXXX';
  
  
    gapi.analytics.auth.authorize({
      container: 'auth-button',
      clientid: CLIENT_ID,
    });
  
    // Step 4: Create the view selector.
  
    var viewSelector = new gapi.analytics.ViewSelector({
      container: 'view-selector'
    });
  
    // Step 5: Create the 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 up the components to work together.
  
    gapi.analytics.auth.on('success', function(response) {
      viewSelector.execute();
    });
  
    viewSelector.on('change', function(ids) {
      var newIds = {
        query: {
          ids: ids
        }
      }
      timeline.set(newIds).execute();
    });
  });
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  Object {error: Object}
  error: Object
  errors: Array[1]
  0: Object
  message: "immediate_failed"
  reason: "invalidParameter"
  __proto__: Object
  length: 1
  __proto__: Array[0]
  message: "immediate_failed"
  __proto__: Object
  __proto__: Object
   cb=gapi.loaded_0:433
  _.nH cb=gapi.loaded_0:433
  _.du.Vh cb=gapi.loaded_0:459
  YP.Ka cb=gapi.loaded_0:466
  _.k.iu cb=gapi.loaded_0:291
  ix cb=gapi.loaded_0:431
  (anonymous function) cb=gapi.loaded_0:433
  h.BE cb=gapi.loaded_0:137
  Wq cb=gapi.loaded_0:140
  _.C.ye cb=gapi.loaded_0:140
  Ap
  </code></pre>