← All changes
|
includes/admin/components/analytics/funnel/bounce-rate.php
+10
-2
1.6.5
→
2.7.0
View file →
| @@ -52,10 +52,18 @@ | ||
| 52 | 52 | |
| 53 | 53 | $neat_data = []; |
| 54 | 54 | |
| 55 | 55 | foreach ( $results as $result ) { |
| 56 | - $total_leave = $result['total_started'] - $result['total_finished']; | |
| 57 | - $bounce_rate = ( $total_leave * 100 ) / $result['total_started']; | |
| 56 | + $total_started = (int) $result['total_started']; | |
| 57 | + $total_finished = (int) $result['total_finished']; | |
| 58 | + | |
| 59 | + if ( $total_started <= 0 ) { | |
| 60 | + $neat_data[ $result['day'] ] = 0.0; | |
| 61 | + continue; | |
| 62 | + } | |
| 63 | + | |
| 64 | + $total_leave = $total_started - $total_finished; | |
| 65 | + $bounce_rate = ( $total_leave * 100 ) / $total_started; | |
| 58 | 66 | |
| 59 | 67 | $neat_data[ $result['day'] ] = floatval( number_format( $bounce_rate, 2 ) ); |
| 60 | 68 | } |
| 61 | 69 | |