Permalink
Browse files

Neater CSS to inherit generic Dashboard styles, minor stylistic tweak…

…s here and there for consistency with other panels
  • Loading branch information...
nickdunn authored and nick-ryall committed Jul 15, 2011
1 parent 6584030 commit b1136960f39ec7562c410813a7a86ef72990328d
Showing with 30 additions and 62 deletions.
  1. +9 −41 assets/dashboard.analytics.index.css
  2. +21 −21 extension.driver.php
@@ -1,49 +1,17 @@
/* PANEL: Google Analytics */
-.google_analytics {
-
- border: 1px solid #CCCCCC;
- background: #fff;
- padding: 5px;
- overflow: hidden;
-}
-
-.google_analytics .info {
-
- float: left;
- padding:10px;
-}
-
-.google_analytics .info h4 {
- margin: 0 0 5px 0;
-}
-
-.google_analytics .info dl {
- margin: 0 0 10px 0;
- overflow: hidden;
-}
-
-.google_analytics .info dt {
- float: left;
- clear: left;
- width: 60%;
+.analytics_panel .graph img {
+ display: block;
+ margin-bottom: 20px;
}
-.google_analytics .info dd {
- float: left;
- width: 40%;
+.secondary .graph img {
+ max-width: 100%;
+ height: auto;
}
-
-
-.google_analytics .graph {
-
+.analytics_panel .info,
+.analytics_panel .terms {
float: left;
- margin-right: 5px;
-
-}
-
-.google_analytics .graph img {
-
- display: block;
+ width: 50%;
}
View
@@ -103,28 +103,25 @@ public function display_results($email, $password, $profile_id) {
//$oAnalytics->setMonth(date('n'), date('Y'));
$oAnalytics->setDateRange($last_month, $today);
-
$wrapper = new XMLElement('div');
- $wrapper->setAttribute('class', 'google_analytics');
$graph = extension_dashboard_analytics::buildChart($oAnalytics);
$wrapper->appendChild($graph);
-
$info = new XMLElement('div');
$info->setAttribute('class', 'info');
$info_header = new XMLElement('h4', 'Quick Information');
$dl_results = new XMLElement('dl');
//Total Pageviews
- $dt_pageviews = new XMLElement('dt', 'Pageviews:');
+ $dt_pageviews = new XMLElement('dt', 'Pageviews');
$dd_pageviews = new XMLElement('dd', array_sum($oAnalytics->getPageviews()));
$dl_results->appendChild($dt_pageviews);
$dl_results->appendChild($dd_pageviews);
//Total Visits
- $dt_visits = new XMLElement('dt', 'Visits:');
+ $dt_visits = new XMLElement('dt', 'Visits');
$dd_visits = new XMLElement('dd', array_sum($oAnalytics->getVisitors()));
$dl_results->appendChild($dt_visits);
@@ -134,15 +131,15 @@ public function display_results($email, $password, $profile_id) {
$pages_visits = $oAnalytics->getData(
array('metrics'=> urlencode('ga:pageviewsPerVisit'))
);
- $dt_pages_visits = new XMLElement('dt', 'Pages/Visit:');
+ $dt_pages_visits = new XMLElement('dt', 'Pages per Visit');
$dd_pages_visits = new XMLElement('dd', round(array_sum($pages_visits),2));
$dl_results->appendChild($dt_pages_visits);
$dl_results->appendChild($dd_pages_visits);
$bounce_rate = $oAnalytics->getData(
array('metrics'=> urlencode('ga:visitBounceRate'))
);
- $dt_bounce_rate = new XMLElement('dt', 'Bounce Rate:');
+ $dt_bounce_rate = new XMLElement('dt', 'Bounce Rate');
$dd_bounce_rate = new XMLElement('dd', round(array_sum($bounce_rate),2).'%');
$dl_results->appendChild($dt_bounce_rate );
$dl_results->appendChild($dd_bounce_rate);
@@ -151,7 +148,7 @@ public function display_results($email, $password, $profile_id) {
$new_visits = $oAnalytics->getData(
array('metrics'=> urlencode('ga:percentNewVisits'))
);
- $dt_new_visits = new XMLElement('dt', '% New Visits:');
+ $dt_new_visits = new XMLElement('dt', '% New Visits');
$dd_new_visits = new XMLElement('dd', round(array_sum($new_visits),2).'%');
$dl_results->appendChild($dt_new_visits);
$dl_results->appendChild($dd_new_visits);
@@ -161,14 +158,17 @@ public function display_results($email, $password, $profile_id) {
$average_time = $oAnalytics->getData(
array('metrics'=> urlencode('ga:avgTimeOnSite'))
);
- $dt_average_time = new XMLElement('dt', 'Avg. Time on Site:');
+ $dt_average_time = new XMLElement('dt', 'Avg. Time on Site');
$dd_average_time = new XMLElement('dd', extension_dashboard_analytics::sec2hms(round(array_sum($average_time),0)));
$dl_results->appendChild($dt_average_time);
$dl_results->appendChild($dd_average_time);
+ $search_terms = new XMLElement('div');
+ $search_terms->setAttribute('class', 'terms');
+
//Search Terms
- $terms_head = new XMLElement('h4', 'Top Keywords:');
+ $terms_head = new XMLElement('h4', 'Top Keywords');
$terms = new XMLElement('ol');
$keywords = array_keys($oAnalytics->getSearchWords());
@@ -179,25 +179,26 @@ public function display_results($email, $password, $profile_id) {
$count++;
if ($count == 10) break;
}
-
-
+
$info->appendChild($info_header);
$info->appendChild($dl_results);
- $info->appendChild($terms_head);
- $info->appendChild($terms);
+
+ $search_terms->appendChild($terms_head);
+ $search_terms->appendChild($terms);
+
$wrapper->appendChild($info);
-
-
+ $wrapper->appendChild($search_terms);
+
return $wrapper;
} catch (Exception $e) {
-
$info = new XMLElement('div');
$info->setAttribute('class', 'info');
$info_header = new XMLElement('h4', 'No data found. Check your account details.');
$info->appendChild($info_header);
+ $info_header->appendChild(new XMLElement('p', '<code>'.(string)$e->getMessage().'</code>'));
return $info;
@@ -222,7 +223,6 @@ public function buildChart($oAnalytics) {
foreach($visit_report as $dimensions => $metric) {
array_push($visits, $metric);
}
-
// Generating visit arrays for the date range.
$views_report = $oAnalytics->getData(
@@ -261,8 +261,8 @@ function max_key($array) {
// Chart settings
$traffic = new GoogleChart;
$traffic->type='lc';
- $traffic->SetImageSize(550,330);
- $traffic->SetChartMargins(40,40,40,40);
+ $traffic->SetImageSize(700,200);
+ $traffic->SetChartMargins(20,20,20,20);
$traffic->SetEncode('simple');
$traffic->AddData($visits);
$traffic->AddData($page_views);
@@ -290,7 +290,7 @@ function max_key($array) {
$traffic->SetGrid(round(100/30,2),round(100/6,2),1,3);
- $traffic->SetTitle('Visits/Page Views of Last 30 Days');
+ $traffic->SetTitle('Visits and Page Views of last 30 days');
$traffic->AddLegend('visits');
$traffic->AddLegend('page views');
$traffic->SetLegendPosition('b');

0 comments on commit b113696

Please sign in to comment.