title: Google analytics api: requestReportData by weeks instead of days?
body: <p>This is how I am getting the pageviews of a url for a custom interval (usually the date of creation of the url and the present)</p>
  
  <pre><code>$ga-&gt;requestReportData(
      $ga_profile_id,
      array('date'),
      array('pageviews'),
      'date', 
      'pagePath == '.$ga_url, 
      $ga_start, /* Creaton day */
      date("Y-m-d", strtotime("0 day", time())), /* Today */
      null,
      1000
  );
  $results = $ga-&gt;getResults();
  </code></pre>
  
  <p>The thing is that some of the urls are old and then my chart looks too saturated:</p>
  
  <p><img src="https://i.stack.imgur.com/ntsZv.png" alt="enter image description here"></p>
  
  <p>So I would like to check the value of the interval in days, and if its big enough; get the pageviews by weeks (and then if its big enough, maybe in months?)</p>
  
  <p>Is it posible?</p>
  
  <p>This is how I am generating the Chart, by the way:</p>
  
  <pre><code>google.load("visualization", "1", {packages:["corechart"]});
    google.setOnLoadCallback(drawChart);
    function drawChart() {
      var data = new google.visualization.DataTable();
  
      &lt;!-- Create the data table --&gt;
      data.addColumn('string', 'Day');
      data.addColumn('number', 'Lecturas');
  
      &lt;!-- Fill the chart with the data pulled from Analtyics. Each row matches the order setup by the columns: day then pageviews --&gt;
      data.addRows([
        &lt;?php
        foreach($results as $result) {
            echo '["'.date('M j',strtotime($result-&gt;getDate())).'", '.$result-&gt;getPageviews().'],';
        }
        ?&gt;
      ]);
  
      var chart = new google.visualization.AreaChart(document.getElementById('chart'));
      chart.draw(data, {width: 630, height: 180, title: '&lt;?php echo  $ga_start.' - '. date("Y-m-d", strtotime("0 day", time())); ?&gt;',
                        colors:['#999999','#ff0000'],
                        areaOpacity: 0.1,
                        hAxis: {textPosition: 'in', showTextEvery: 30, slantedText: false, textStyle: { color: '#555555', fontSize: 10 } },
                        pointSize: 5,
                        legend: 'none',
                        chartArea:{left:0,top:30,width:"100%",height:"100%"}
      });
  </code></pre>