commons
5 years ago
dashboard
5 years ago
dialogs
5 years ago
email-lists
5 years ago
embedded
5 years ago
footer
5 years ago
global
5 years ago
integrations
5 years ago
integrations-page
5 years ago
popup
5 years ago
settings
5 years ago
slidein
5 years ago
sshare
5 years ago
dashboard.php
5 years ago
entries.php
5 years ago
integrations.php
5 years ago
settings.php
5 years ago
upsell.php
5 years ago
widget-analytics.php
5 years ago
widget-analytics.php
113 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Dashboard Hustle analytics widget: Displayed on site dashboards with stats. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.1.0 |
| 7 | */ |
| 8 | |
| 9 | $array_days_ago = $this->admin->get_analytic_ranges(); |
| 10 | |
| 11 | $active_module_types = $settings['modules']; |
| 12 | |
| 13 | $available_module_types = array( |
| 14 | 'overall' => __( 'Overall', 'hustle' ), |
| 15 | Hustle_Module_Model::POPUP_MODULE => __( 'Pop-ups', 'hustle' ), |
| 16 | Hustle_Module_Model::SLIDEIN_MODULE => __( 'Slide-ins', 'hustle' ), |
| 17 | Hustle_Module_Model::EMBEDDED_MODULE => __( 'Embeds', 'hustle' ), |
| 18 | Hustle_Module_Model::SOCIAL_SHARING_MODULE => __( 'Social Sharing', 'hustle' ), |
| 19 | ); |
| 20 | |
| 21 | ?> |
| 22 | <div |
| 23 | class="hustle-widget" |
| 24 | data-nonce="<?php echo esc_attr( wp_create_nonce( 'hustle_update_wp_dashboard_chart' ) ); ?>" |
| 25 | > |
| 26 | |
| 27 | <form class="hustle-widget-header"> |
| 28 | |
| 29 | <div class="hustle-form-field"> |
| 30 | |
| 31 | <label for="hustle-analytics-show" id="hustle-analytics-show-label" class="hustle-label" aria-labelledby="hustle-analytics-show-label"><?php esc_html_e( 'Show', 'hustle' ); ?></label> |
| 32 | |
| 33 | <select id="hustle-analytics-show" class="hustle-select"> |
| 34 | <option value="view" selected><?php esc_html_e( 'Views', 'hustle' ); ?></option> |
| 35 | <option value="conversion"><?php esc_html_e( 'All Conversions', 'hustle' ); ?></option> |
| 36 | <option value="cta_conversion"><?php esc_html_e( 'CTA Conversions', 'hustle' ); ?></option> |
| 37 | <option value="optin_conversion"><?php esc_html_e( 'Optin Conversions', 'hustle' ); ?></option> |
| 38 | <option value="rate"><?php esc_html_e( 'Conversion Rate', 'hustle' ); ?></option> |
| 39 | </select> |
| 40 | |
| 41 | </div> |
| 42 | |
| 43 | <div class="hustle-form-field"> |
| 44 | |
| 45 | <label for="hustle-analytics-data" id="hustle-analytics-data-label" class="hustle-label"><?php esc_html_e( 'from', 'hustle' ); ?></label> |
| 46 | |
| 47 | <select id="hustle-analytics-data" class="hustle-select" aria-labelledby="hustle-analytics-data-label"> |
| 48 | <?php foreach ( $array_days_ago as $val => $range_title ) : ?> |
| 49 | <option value="<?php echo esc_attr( $val ); ?>"<?php selected( $val, 7 ); ?>><?php echo esc_html( $range_title ); ?></option> |
| 50 | <?php endforeach; ?> |
| 51 | </select> |
| 52 | |
| 53 | </div> |
| 54 | |
| 55 | <button id="hustle-analytics-apply" class="button hustle-button"><?php esc_html_e( 'Apply', 'hustle' ); ?></button> |
| 56 | |
| 57 | </form> |
| 58 | |
| 59 | <div class="hustle-widget-body"> |
| 60 | |
| 61 | <div class="hustle-options-embed" style="display: none;"> |
| 62 | |
| 63 | <button role="tab" class="hustle-option hustle-active" aria-selected="true" data-display-type="total"><?php esc_html_e( 'Total', 'hustle' ); ?></button> |
| 64 | |
| 65 | <button role="tab" class="hustle-option" aria-selected="false" data-display-type="<?php echo esc_attr( Hustle_SShare_Model::FLOAT_MODULE ); ?>"><?php esc_html_e( 'Floating', 'hustle' ); ?></button> |
| 66 | |
| 67 | <button role="tab" class="hustle-option" aria-selected="false" data-display-type="<?php echo esc_attr( Hustle_Module_Model::INLINE_MODULE ); ?>"><?php esc_html_e( 'Inline', 'hustle' ); ?></button> |
| 68 | |
| 69 | <button role="tab" class="hustle-option" aria-selected="false" data-display-type="<?php echo esc_attr( Hustle_Module_Model::WIDGET_MODULE ); ?>"><?php esc_html_e( 'Widget', 'hustle' ); ?></button> |
| 70 | |
| 71 | <button role="tab" class="hustle-option" aria-selected="false" data-display-type="<?php echo esc_attr( Hustle_Module_Model::SHORTCODE_MODULE ); ?>"><?php esc_html_e( 'Shortcode', 'hustle' ); ?></button> |
| 72 | |
| 73 | </div> |
| 74 | |
| 75 | <div class="hustle-chart-wrap"> |
| 76 | |
| 77 | <div class="hustle-options-chart"> |
| 78 | |
| 79 | <?php foreach ( $active_module_types as $module_type ) : ?> |
| 80 | |
| 81 | <?php $is_selected = $module_type === $active_module_types[0]; ?> |
| 82 | <button |
| 83 | role="tab" |
| 84 | class="hustle-option<?php echo $is_selected ? ' hustle-active' : ''; ?>" |
| 85 | aria-selected="<?php echo $is_selected ? 'true' : 'false'; ?>" |
| 86 | data-module-type="<?php echo esc_attr( $module_type ); ?>" |
| 87 | > |
| 88 | <span class="hustle-option--title"><?php echo esc_html( $available_module_types[ $module_type ] ); ?></span> |
| 89 | <span class="hustle-option--value"></span> |
| 90 | <span class="hustle-option--trend"></span> |
| 91 | </button> |
| 92 | |
| 93 | <?php endforeach; ?> |
| 94 | |
| 95 | </div> |
| 96 | |
| 97 | <div class="hustle-chart-graph"> |
| 98 | |
| 99 | <div class="hustle-message-empty" style="display:none;"> |
| 100 | <p class="hustle-title"><?php esc_html_e( "We haven't collected enough data yet.", 'hustle' ); ?></p> |
| 101 | <p class="hustle-text"><?php esc_html_e( 'You will start viewing the performance statistics of your Hustle modules shortly. So feel free to check back soon', 'hustle' ); ?></p> |
| 102 | </div> |
| 103 | |
| 104 | <canvas id="hustle-analytics-chart"></canvas> |
| 105 | |
| 106 | </div> |
| 107 | |
| 108 | </div> |
| 109 | |
| 110 | </div> |
| 111 | |
| 112 | </div> |
| 113 |