Google analytics API

Google analytics API
0.0 0


Need help with the basic implementation of this code


You are going to need to be more specific about what you want to do.

What have you already tried? What was the result?


3 div’s provided by google - inserted them in the HTML website landing page where the dashboard is to be displayed.

Am I inserting the right code in the right div or am I going wrong somewhere?

  1. //Inserted the "Load the Embed API library code here"
  2. var dataChart = new{
    query: {
    metrics: ‘ga:sessions’,
    dimensions: ‘ga:date’,
    ‘start-date’: ‘30daysAgo’,
    ‘end-date’: ‘yesterday’
    chart: {
    container: ‘chart-container’,
    type: ‘LINE’,
    options: {
    width: ‘100%’
    }); { /** * 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". */{ container: 'embed-api-auth-container', clientid: 'REPLACE WITH YOUR CLIENT ID' }); /** * Create a new ViewSelector instance to be rendered inside of an * element with the id "view-selector-container". */ var viewSelector = new{ container: 'view-selector-container' }); // Render the view selector to the page. viewSelector.execute(); /** * Render the dataChart on the page whenever a new view is selected. */ viewSelector.on('change', function(ids) { dataChart.set({query: {ids: ids}}).execute(); }); });