| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* View of General Statistics |
| 5 |
*/ |
| 6 |
|
| 7 |
function pa_include_general( $current, $stats) { |
| 8 |
?> |
| 9 |
<div class="data_boxes"> |
| 10 |
<div class="data_boxes_title"><?php echo _e( 'General Statistics', 'wp-analytify'); ?> <div class="arrow_btn"></div></div> |
| 11 |
<div class="data_container"> |
| 12 |
<div class="grids_auto_size"> |
| 13 |
<div class="grid_title"> |
| 14 |
SESSIONS |
| 15 |
</div> |
| 16 |
<div class="grid_data cen"> |
| 17 |
<div class="data_value"><?php echo number_format( $stats->totalsForAllResults['ga:sessions'] ); ?></div> |
| 18 |
</div> |
| 19 |
<div class="grid_footer cen"> |
| 20 |
Total number of Sessions within the date range. A session is the period time a user is actively engaged with your website, app, etc. |
| 21 |
</div> |
| 22 |
</div> |
| 23 |
<div class="grids_auto_size"> |
| 24 |
<div class="grid_title"> |
| 25 |
USERS |
| 26 |
</div> |
| 27 |
<div class="grid_data cen"> |
| 28 |
<div class="data_value"><?php echo number_format($stats->totalsForAllResults['ga:users']); ?></div> |
| 29 |
</div> |
| 30 |
<div class="grid_footer cen"> |
| 31 |
Users that have had at least one session within the selected date range. Includes both new and returning users. |
| 32 |
</div> |
| 33 |
</div> |
| 34 |
<div class="grids_auto_size"> |
| 35 |
<div class="grid_title"> BOUNCE RATE </div> |
| 36 |
<div class="grid_data cen"> |
| 37 |
<div class="data_value"> |
| 38 |
<?php if ($stats->totalsForAllResults['ga:entrances'] <= 0) { ?> |
| 39 |
0.00% |
| 40 |
<?php |
| 41 |
} //$stats->totalsForAllResults['ga:entrances'] <= 0 |
| 42 |
else { |
| 43 |
echo number_format(round(($stats->totalsForAllResults['ga:bounces'] / $stats->totalsForAllResults['ga:entrances']) * 100, 2), 2); |
| 44 |
?>% |
| 45 |
<?php } ?> |
| 46 |
</div> |
| 47 |
</div> |
| 48 |
<div class="grid_footer cen"> |
| 49 |
Bounce Rate is the percentage of single-page visits (i.e. visits in which the person left your site from the entrance page without interacting with the page). |
| 50 |
</div> |
| 51 |
</div> |
| 52 |
<div class="grids_auto_size"> |
| 53 |
<div class="grid_title"> AVG TIME ON SITE </div> |
| 54 |
<div class="grid_data cen"> |
| 55 |
<div class="data_value"> |
| 56 |
<?php |
| 57 |
if ($stats->totalsForAllResults['ga:sessions'] <= 0) { |
| 58 |
?> |
| 59 |
00:00:00 |
| 60 |
<?php |
| 61 |
} //$stats->totalsForAllResults['ga:sessions'] <= 0 |
| 62 |
else { |
| 63 |
?> |
| 64 |
<?php |
| 65 |
echo $current->pa_pretty_time($stats->totalsForAllResults['ga:avgTimeOnPage']); |
| 66 |
?> |
| 67 |
<?php } ?> |
| 68 |
</div> |
| 69 |
</div> |
| 70 |
<div class="grid_footer cen"> <?php echo _e('The amount of time someone spends on your site.' , 'wp-analytify')?> </div> |
| 71 |
</div> |
| 72 |
<div class="grids_auto_size"> |
| 73 |
<div class="grid_title"> <?php echo _e('AVERAGE PAGES' , 'wp-analytify')?> </div> |
| 74 |
<div class="grid_data cen"> |
| 75 |
<div class="data_value"> |
| 76 |
<?php |
| 77 |
if ($stats->totalsForAllResults['ga:sessions'] <= 0) { |
| 78 |
?> |
| 79 |
0.00 |
| 80 |
<?php |
| 81 |
} //$stats->totalsForAllResults['ga:sessions'] <= 0 |
| 82 |
else { |
| 83 |
?> |
| 84 |
<?php |
| 85 |
echo number_format(round($stats->totalsForAllResults['ga:pageviews'] / $stats->totalsForAllResults['ga:sessions'], 2), 2); |
| 86 |
?> |
| 87 |
<?php } ?> |
| 88 |
</div> |
| 89 |
</div> |
| 90 |
<div class="grid_footer cen"> |
| 91 |
<?php echo _e('Pages/Session is the average number of pages viewed during a session. Repeated views of a single page are counted.', 'wp-analytify')?> |
| 92 |
</div> |
| 93 |
</div> |
| 94 |
<div class="grids_auto_size"> |
| 95 |
<div class="grid_title"> <?php echo _e('PAGE VIEWS', 'wp-analytify')?> </div> |
| 96 |
<div class="grid_data cen"> |
| 97 |
<div class="data_value"> |
| 98 |
|
| 99 |
<?php |
| 100 |
if ($stats->totalsForAllResults['ga:pageviews'] <= 0) { |
| 101 |
echo '0'; |
| 102 |
} |
| 103 |
else { |
| 104 |
echo $current->wpa_number_format( $stats->totalsForAllResults['ga:pageviews']); |
| 105 |
} |
| 106 |
?> |
| 107 |
|
| 108 |
</div> |
| 109 |
</div> |
| 110 |
<div class="grid_footer cen"> |
| 111 |
<?php echo _e('Pageviews is the total number of pages viewed. Repeated views of a single page are counted.', 'wp-analytify');?> |
| 112 |
</div> |
| 113 |
</div> |
| 114 |
<div class="grids_auto_size"> |
| 115 |
<div class="grid_title"> |
| 116 |
<?php echo _e(' % NEW SESSIONS', 'wp-analytify')?> |
| 117 |
</div> |
| 118 |
<div class="grid_data cen"> |
| 119 |
<div class="data_value"> |
| 120 |
<?php |
| 121 |
|
| 122 |
$total_sessions = $stats->totalsForAllResults['ga:sessions']; |
| 123 |
$newusers = $stats->totalsForAllResults['ga:newUsers']; |
| 124 |
|
| 125 |
if( $total_sessions > 0 ){ |
| 126 |
echo number_format(round(($newusers / $total_sessions) * 100, 2), 2); |
| 127 |
} |
| 128 |
else{ |
| 129 |
echo '0'; |
| 130 |
} |
| 131 |
?> |
| 132 |
% |
| 133 |
</div> |
| 134 |
</div> |
| 135 |
<div class="grid_footer cen"> |
| 136 |
<?php echo _e('Pages/Session is the average number of pages viewed during a session. Repeated views of a single page are counted.', 'wp-analytify');?> |
| 137 |
</div> |
| 138 |
</div> |
| 139 |
<div class="grids_auto_size"> |
| 140 |
<div class="grid_title"> <?php echo _e( 'NEW/RETURNING VISITORS' , 'wp-analytify' ); ?> </div> |
| 141 |
<div class="grid_data cen"> |
| 142 |
<div class="data_value"> |
| 143 |
<?php |
| 144 |
if (isset($stats->totalsForAllResults)) |
| 145 |
{ |
| 146 |
if (!empty($stats["rows"])): |
| 147 |
$returning = $stats->totalsForAllResults['ga:sessions'] - $stats->totalsForAllResults['ga:newUsers']; |
| 148 |
?> |
| 149 |
<script type="text/javascript"> |
| 150 |
|
| 151 |
google.load("visualization", "1", {packages:["corechart"],'callback': drawChart}); |
| 152 |
|
| 153 |
function drawChart() { |
| 154 |
var data = google.visualization.arrayToDataTable([ |
| 155 |
['Visitors', 'Visitors Records'], |
| 156 |
['New Visitors',<?php echo $stats->totalsForAllResults['ga:newUsers']; ?>], |
| 157 |
['Return Visitors',<?php echo $returning; ?>], |
| 158 |
]); |
| 159 |
|
| 160 |
var options = { |
| 161 |
is3D: true, |
| 162 |
legend:'none', |
| 163 |
colors: ['#4fca74', '#0E9236'] |
| 164 |
}; |
| 165 |
|
| 166 |
var formatter = new google.visualization.NumberFormat({fractionDigits: 0}); |
| 167 |
formatter.format(data, 1); |
| 168 |
|
| 169 |
var chart = new google.visualization.PieChart(document.getElementById('visitorschart')); |
| 170 |
chart.draw(data, options); |
| 171 |
} |
| 172 |
|
| 173 |
</script> |
| 174 |
<div id="visitorschart" style="width: 99%; height:150px;"></div> |
| 175 |
<span class="visitor-stats-new"><span class="font-sizing"> New (<?php echo $current->wpa_number_format( $stats->totalsForAllResults['ga:newUsers']); ?>)</span> </span> |
| 176 |
<span class="visitor-stats-ret"><span class="font-sizing"> Returning (<?php echo $current->wpa_number_format( $returning ); ?>)</span> </span> |
| 177 |
<?php |
| 178 |
endif; |
| 179 |
} |
| 180 |
?> |
| 181 |
</div> |
| 182 |
</div> |
| 183 |
</div> |
| 184 |
</div> |
| 185 |
|
| 186 |
<div class="data_boxes_footer"> |
| 187 |
<span class="blk"> |
| 188 |
<span class="dot"></span> |
| 189 |
<span class="line"></span> |
| 190 |
</span> |
| 191 |
<span class="information-txt"> |
| 192 |
<?php echo _e('Did you know that total time on your site is' , 'wp-analytify')?> |
| 193 |
<?php |
| 194 |
echo $current->pa_pretty_time($stats->totalsForAllResults['ga:sessionDuration']); |
| 195 |
?> |
| 196 |
</span> |
| 197 |
</div> |
| 198 |
</div> |
| 199 |
|
| 200 |
<?php } ?> |