PluginProbe ʕ •ᴥ•ʔ
ShareThis Dashboard for Google Analytics / trunk
ShareThis Dashboard for Google Analytics vtrunk
3.3.2 trunk 1.0.7 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.5 2.3.5 2.3.6 2.3.7 2.3.8 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 3.0.0 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.3.0 3.3.1
googleanalytics / view / ga-dashboard-widget.php
googleanalytics / view Last commit date
templates 2 months ago ga-accounts-selector.php 2 months ago ga-auth-button.php 2 months ago ga-code.php 2 months ago ga-dashboard-widget.php 2 months ago ga-debug-modal.php 2 months ago ga-ga4-settings.php 2 months ago ga-googleanalytics-loader.php 2 months ago ga-notice.php 2 months ago ga-oauth-notice.php 2 months ago ga-wp-notice.php 2 months ago old-page.php 2 months ago page.php 2 months ago statistics.php 2 months ago stats.php 2 months ago trending.php 2 months ago
ga-dashboard-widget.php
113 lines
1 <?php
2 /**
3 * Dashboard Widget view.
4 *
5 * @package GoogleAnalytics
6 */
7
8 if (!defined('ABSPATH')) exit;
9
10 $ga_nonce = isset( $ga_nonce ) ? $ga_nonce : '';
11 $more_details_url = isset( $more_details_url ) ? $more_details_url : '#';
12 $show_trigger_button = isset( $show_trigger_button ) ? $show_trigger_button : false;
13 ?>
14 <div class="wrap ga-wrap">
15 <div class="form-group">
16 <select id="range-selector" autocomplete="off">
17 <option value="7daysAgo"><?php esc_html_e( 'Last 7 Days', 'googleanalytics' ); ?></option>
18 <option value="30daysAgo" selected="selected">
19 <?php esc_html_e( 'Last 30 Days', 'googleanalytics' ); ?></option>
20 <option value="90daysAgo"><?php esc_html_e( 'Last 90 Days', 'googleanalytics' ); ?></option>
21 </select>
22
23 <select id="metrics-selector" autocomplete="off">
24 <option value="pageviews"><?php esc_html_e( 'Pageviews', 'googleanalytics' ); ?></option>
25 <option value="sessions"><?php esc_html_e( 'Visits', 'googleanalytics' ); ?></option>
26 <option value="users"><?php esc_html_e( 'Users', 'googleanalytics' ); ?></option>
27 <option value="organicSearches"><?php esc_html_e( 'Organic Search', 'googleanalytics' ); ?></option>
28 <option value="visitBounceRate"><?php esc_html_e( 'Bounce Rate', 'googleanalytics' ); ?></option>
29 </select>
30
31 <div class="ga-loader-wrapper">
32 <div class="ga-loader"></div>
33 </div>
34 </div>
35
36 <div>
37 <div id="chart_div" style="width: 100%;">
38 <?php if ( true === $show_trigger_button ) : ?>
39 <div style="text-align: center">
40 <div style="margin: 20px auto;">
41 <button id="ga-widget-trigger" style="border: 1px solid #cccccc;width: 60%; padding: 10px"
42 class="button-link">
43 <?php esc_html_e( 'Click here to get data', 'googleanalytics' ); ?>
44 </button>
45 </div>
46 </div>
47 <?php endif; ?>
48 </div>
49 <div id="ga_widget_error" class="notice notice-warning hidden"></div>
50 <div>
51 <div id="boxes-container">
52 <div class="ga-box-row">
53 <?php if ( false === empty( $boxes ) ) : ?>
54 <?php $iter = 1; ?>
55 <?php foreach ( $boxes as $k => $v ) : ?>
56 <div class="ga-box-column ga-box-dashboard">
57 <div style="color: grey; font-size: 13px;" id="ga_box_dashboard_label_<?php echo esc_attr( $k ); ?>">
58 <?php echo esc_html( $v['label'] ); ?></div>
59 <div style="font-size: 15px;" id="ga_box_dashboard_value_<?php echo esc_attr( $k ); ?>">
60 <?php echo esc_html( $v['value'] ); ?></div>
61 </div>
62 <?php if ( ( ( $iter ++ ) % 3 ) === 0 ) : ?>
63 </div>
64 <div class="ga-box-row">
65 <?php endif; ?>
66 <?php endforeach; ?>
67 <?php endif; ?>
68 </div>
69 </div>
70 </div>
71 </div>
72
73 <div style="margin-top: 5px;">
74 <?php
75 echo wp_kses_post(
76 sprintf(
77 '<a href="%s">' . __( 'Show more details', 'googleanalytics' ) . '</a>',
78 esc_url( $more_details_url )
79 )
80 );
81 ?>
82 </div>
83 </div>
84
85 <script type="text/javascript">
86 const GA_NONCE = '<?php echo esc_js( $ga_nonce ); ?>';
87 const GA_NONCE_FIELD = '<?php echo esc_js( Ga_Admin_Controller::GA_NONCE_FIELD_NAME ); ?>';
88 <?php if ( false === $show_trigger_button ) : ?>
89 <?php if ( false === empty( $chart ) ) : ?>
90 dataArr = [ [ 'Day', 'Pageviews' ],
91 <?php
92 $arr = '';
93 foreach ( $chart as $row ) {
94 if ( $arr ) {
95 $arr .= ',';
96 }
97 $arr .= "['" . $row['day'] . "'," . $row['current'] . ']';
98 }
99
100 echo esc_js( $arr );
101 ?>
102 ];
103
104 ga_dashboard.init( dataArr, true );
105 ga_dashboard.events( dataArr );
106 <?php endif; ?>
107 <?php else : ?>
108 dataArr = [ [ 'Day', 'Pageviews' ], [] ];
109 ga_dashboard.init( false, false );
110 ga_dashboard.events();
111 <?php endif; ?>
112 </script>
113