| 1 |
<?php |
| 2 |
/** |
| 3 |
* View of scroll depth statistics for single page. |
| 4 |
* |
| 5 |
* @package WP_Analytify |
| 6 |
*/ |
| 7 |
|
| 8 |
// Exit if accessed directly. |
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; } |
| 11 |
|
| 12 |
/** |
| 13 |
* View of scroll depth statistics for single page. |
| 14 |
* |
| 15 |
* @param WP_Analytify $wp_analytify Main plugin instance. |
| 16 |
* @param array<string, mixed> $stats Statistics data. |
| 17 |
* |
| 18 |
* @return void |
| 19 |
*/ |
| 20 |
function wpa_include_ga_single_depth( $wp_analytify, $stats ) { |
| 21 |
|
| 22 |
$rows = $stats['rows']; |
| 23 |
$total_visits = $stats['aggregations']['eventCount']; |
| 24 |
?> |
| 25 |
|
| 26 |
<div class="analytify_general_status analytify_status_box_wraper"> |
| 27 |
<div class="analytify_status_header"> |
| 28 |
<h3><?php esc_html_e( 'Scroll Depth Reach', 'wp-analytify' ); ?></h3> |
| 29 |
<div class="analytify_status_header_value keywords_total"> |
| 30 |
<span class="analytify_medium_f"><?php esc_html_e( 'Total Reach', 'wp-analytify' ); ?></span> |
| 31 |
</div> |
| 32 |
</div> |
| 33 |
|
| 34 |
<table class="analytify_bar_tables"> |
| 35 |
<tbody> |
| 36 |
<?php |
| 37 |
if ( ! empty( $rows ) ) { |
| 38 |
$total_visits = $stats['aggregations']['eventCount']; |
| 39 |
|
| 40 |
foreach ( $rows as $row ) { |
| 41 |
?> |
| 42 |
<tr> |
| 43 |
<td> |
| 44 |
<?php echo esc_html( $row['customEvent:link_label'] ) . '%'; ?> |
| 45 |
<span class="analytify_bar_graph"> |
| 46 |
<span style="width: <?php echo esc_attr( ( $row['eventCount'] / $total_visits ) * 100 ); ?>%"></span> |
| 47 |
</span> |
| 48 |
</td> |
| 49 |
<td class="analytify_txt_center analytify_value_row"><?php echo esc_html( WPANALYTIFY_Utils::pretty_numbers( $row['eventCount'] ) ); ?></td> |
| 50 |
</tr> |
| 51 |
<?php |
| 52 |
} |
| 53 |
} else { |
| 54 |
echo wp_kses_post( method_exists( $wp_analytify, 'no_records' ) ? $wp_analytify->no_records() : '<p>' . esc_html__( 'No records found', 'wp-analytify' ) . '</p>' ); |
| 55 |
} |
| 56 |
?> |
| 57 |
</tbody> |
| 58 |
</table> |
| 59 |
</div> |
| 60 |
|
| 61 |
<?php |
| 62 |
} |
| 63 |
|