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