Been having a little play with the division by zero error and have managed to stop it, still get the little pop up box but there’s no errors showing under the tables now.
<?php
ob_start();
$report_name = '<b>Month</b> Views & Duration';
$ga = new gapi(ga_email,ga_password);
$ga->requestReportData(ga_profile_id,array('date'),array('visits','visitors','pageviews','newVisits','timeOnSite'),array('-date'));
//$ga->requestReportData(ga_profile_id,array('browser','browserVersion'),array('pageviews','visits'));
$output .= '
<div class="tab-page" id="tab-'.$report_name.'">
<h2 class="tab">'.$report_name.'</h2>
<script type="text/javascript">tpUser.addTabPage( document.getElementById( "'.$report_name.'" ) );</script>
<div class="sectionBody">
<table>
<tr>
<th>Date</th>
<th>Pageviews</th>
<th>Pageviews per Visit</th>
<th>Visitors</th>
<th>% New Visitors</th>
<th>Visit Duration ( Mins:Secs )</th>
</tr>';
foreach($ga->getResults() as $result){
$day = substr($result,6);
$month = substr($result,4,2);
$year = substr($result,0,4);
if($result->getPageviews()>= 1 && $result->getVisits() >= 1){
$views_per_visit = number_format(($result->getPageviews()/$result->getVisits()), 2, '.', '');
}
else{
$views_per_visit = 'N/A';
}
if($result->gettimeOnSite()>= 1 && $result->gettimeOnSite() >= 1){
$day_number = number_format(($result->gettimeOnSite()/$result->getVisits()), 0, '', '');
}
else{
$time_On_Site = 'N/A';
}
if($result->getnewVisits()>= 1 && $result->getnewVisits() >= 1){
$percent_new = number_format((($result->getnewVisits()/$result->getVisitors())*100), 2, '.', '');
}
else{
$new_Visits = 'N/A';
}
$output .= '
<tr>
<td>'.$day.' - '.$month.' - '.$year.'</td>
<td>'.$result->getPageviews() .'</td>
<td>'.$views_per_visit.'</td>
<td>'.$result->getVisitors() .'</td>
<td>'.$percent_new.'%</td>
<td>'.strftime("%M:%S",$day_number).'</td>
</tr>';
}
$total_number = number_format(($ga->gettimeOnSite()/($ga->getTotalResults()-1)), 2, '', '');
$output .= '
</table>
<table>
<tr>
<th>Total Pageviews</th>
<td>'.$ga->getPageviews() .'</td>
<th>Average Daily Pageviews</th>
<td>'.number_format(($ga->getPageviews()/($ga->getTotalResults()-1)), 2, '.', '').'</td>
</tr>
<tr>
<th>Total Visits</th>
<td>'.$ga->getVisits() .'</td>
<th>Average Daily Visits</th>
<td>'.number_format(($ga->getVisits()/($ga->getTotalResults()-1)), 2, '.', '').'</td>
</tr>
<tr>
<th>Total Time</th>
<td>'. gmstrftime("%H:%M:%S",$ga->gettimeOnSite()).'</td>
<th>Average Daily Visit Duration ( Hrs:Mins:Secs )</th>
<td>'. strftime("%M:%S",number_format(($ga->gettimeOnSite()/($ga->getTotalResults()-1)), 0, '', '')).'</td>
</tr>
</table>
</div>
</div>';
$output .=ob_get_clean();
?>