ga_accounts_selector.php
9 years ago
ga_auth_button.php
9 years ago
ga_code.php
9 years ago
ga_dashboard_widget.php
9 years ago
ga_debug_modal.php
8 years ago
ga_googleanalytics_loader.php
9 years ago
ga_notice.php
8 years ago
ga_oauth_notice.php
9 years ago
ga_wp_notice.php
9 years ago
page.php
8 years ago
statistics.php
9 years ago
stats.php
9 years ago
trending.php
8 years ago
ga_dashboard_widget.php
89 lines
| 1 | <div class="wrap ga-wrap"> |
| 2 | |
| 3 | <div class="form-group"> |
| 4 | <select id="range-selector" autocomplete="off"> |
| 5 | <option value="7daysAgo">Last 7 Days</option> |
| 6 | <option value="30daysAgo" selected="selected">Last 30 Days</option> |
| 7 | <option value="90daysAgo">Last 90 Days</option> |
| 8 | </select> |
| 9 | |
| 10 | <select id="metrics-selector" autocomplete="off"> |
| 11 | <option value="pageviews">Pageviews</option> |
| 12 | <option value="sessions">Visits</option> |
| 13 | <option value="users">Users</option> |
| 14 | <option value="organicSearches">Organic Search</option> |
| 15 | <option value="visitBounceRate">Bounce Rate</option> |
| 16 | </select> |
| 17 | |
| 18 | <div class="ga-loader-wrapper"> |
| 19 | <div class="ga-loader"></div> |
| 20 | </div> |
| 21 | </div> |
| 22 | |
| 23 | <div> |
| 24 | <div id="chart_div" style="width: 100%;"> |
| 25 | <?php if ( $show_trigger_button ): ?> |
| 26 | <div style="text-align: center"> |
| 27 | <div style="margin: 20px auto;"> |
| 28 | <button id="ga-widget-trigger" style="border: 1px solid #cccccc;width: 60%; padding: 10px" |
| 29 | class="button-link">Click here to get data |
| 30 | </button> |
| 31 | </div> |
| 32 | </div> |
| 33 | <?php endif; ?> |
| 34 | </div> |
| 35 | <div id="ga_widget_error" class="notice notice-warning" style="display: none;"></div> |
| 36 | <div> |
| 37 | <div id="boxes-container"> |
| 38 | <div class="ga-box-row"> |
| 39 | <?php if ( ! empty( $boxes ) ) : ?> |
| 40 | <?php $iter = 1; ?> |
| 41 | <?php foreach ( $boxes as $k => $v ) : ?> |
| 42 | <div class="ga-box-column ga-box-dashboard"> |
| 43 | <div style="color: grey; font-size: 13px;" |
| 44 | id="ga_box_dashboard_label_<?php echo $k; ?>"><?php echo $v['label'] ?></div> |
| 45 | <div style="font-size: 15px;" |
| 46 | id="ga_box_dashboard_value_<?php echo $k; ?>"><?php echo $v['value'] ?></div> |
| 47 | </div> |
| 48 | <?php if ( ( ( $iter ++ ) % 3 ) == 0 ) : ?> |
| 49 | </div> |
| 50 | <div class="ga-box-row"> |
| 51 | <?php endif; ?> |
| 52 | <?php endforeach; ?> |
| 53 | <?php endif; ?> |
| 54 | </div> |
| 55 | </div> |
| 56 | </div> |
| 57 | </div> |
| 58 | |
| 59 | <div style="margin-top: 5px;"><?php echo sprintf( '<a href="%s">' . __( 'Show more details' ) . '</a>', |
| 60 | $more_details_url ); ?></div> |
| 61 | </div> |
| 62 | |
| 63 | <script type="text/javascript"> |
| 64 | const GA_NONCE = '<?php echo $ga_nonce; ?>'; |
| 65 | const GA_NONCE_FIELD = '<?php echo Ga_Admin_Controller::GA_NONCE_FIELD_NAME; ?>'; |
| 66 | <?php if ( empty( $show_trigger_button ) ): ?> |
| 67 | <?php if ( ! empty( $chart ) ) : ?> |
| 68 | dataArr = [['Day', 'Pageviews'],<?php |
| 69 | $arr = ""; |
| 70 | foreach ( $chart as $row ) { |
| 71 | if ( $arr ) { |
| 72 | $arr .= ","; |
| 73 | } |
| 74 | $arr .= "['" . $row['day'] . "'," . $row['current'] . "]"; |
| 75 | } |
| 76 | |
| 77 | echo $arr; |
| 78 | ?>]; |
| 79 | |
| 80 | ga_dashboard.init(dataArr, true); |
| 81 | ga_dashboard.events(dataArr); |
| 82 | <?php endif; ?> |
| 83 | <?php else: ?> |
| 84 | dataArr = [['Day', 'Pageviews'], []]; |
| 85 | ga_dashboard.init(false, false); |
| 86 | ga_dashboard.events(); |
| 87 | <?php endif; ?> |
| 88 | </script> |
| 89 |