access.php
6 years ago
advanced_settings.php
5 years ago
exclusion_settings.php
6 years ago
geolocation_settings.php
6 years ago
get_started.php
6 years ago
info.php
5 years ago
info_bug_report.php
6 years ago
info_help.php
5 years ago
info_high_traffic.php
6 years ago
info_multisite.php
6 years ago
info_newsletter.php
6 years ago
info_shared.php
6 years ago
marketplace.php
5 years ago
privacy_gdpr.php
5 years ago
settings.php
6 years ago
summary.php
5 years ago
systemreport.php
6 years ago
tracking.php
5 years ago
update_notice_clear_cache.php
6 years ago
exclusion_settings.php
153 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Matomo - free/libre analytics platform |
| 4 | * |
| 5 | * @link https://matomo.org |
| 6 | * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 7 | * @package matomo |
| 8 | * Code Based on |
| 9 | * @author André Bräkling |
| 10 | * @package WP_Matomo |
| 11 | * https://github.com/braekling/matomo |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | use Piwik\Piwik; |
| 16 | use WpMatomo\Admin\ExclusionSettings; |
| 17 | |
| 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 19 | exit; |
| 20 | } |
| 21 | /** @var bool $was_updated */ |
| 22 | /** @var bool $exclude_visits_cookie */ |
| 23 | /** @var string $current_ip */ |
| 24 | /** @var string $excluded_ips */ |
| 25 | /** @var string $excluded_user_agents */ |
| 26 | /** @var string $excluded_query_params */ |
| 27 | /** @var bool|string|int $keep_url_fragments */ |
| 28 | /** @var \WpMatomo\Settings $settings */ |
| 29 | |
| 30 | ?> |
| 31 | |
| 32 | <?php |
| 33 | if ( $was_updated ) { |
| 34 | include 'update_notice_clear_cache.php'; |
| 35 | } |
| 36 | ?> |
| 37 | <?php if ($settings->is_network_enabled() && is_network_admin()) { ?> |
| 38 | <h2>Exclusion settings</h2> |
| 39 | <p> |
| 40 | Exclusion settings have to be configured on a per blog basis. |
| 41 | Should you wish to change any setting, please go to the Matomo exclusion settings within each blog. |
| 42 | We are hoping to improve this in the future. |
| 43 | </p> |
| 44 | <?php } else { ?> |
| 45 | |
| 46 | <form method="post"> |
| 47 | <?php wp_nonce_field( ExclusionSettings::NONCE_NAME ); ?> |
| 48 | |
| 49 | <p><?php esc_html_e( 'Configure exclusions.', 'matomo' ); ?></p> |
| 50 | <table class="matomo-tracking-form widefat"> |
| 51 | <tbody> |
| 52 | |
| 53 | <tr> |
| 54 | <th width="20%" scope="row"><label><?php esc_html_e( 'Tracking filter', 'matomo' ); ?></label>: |
| 55 | </th> |
| 56 | <td> |
| 57 | <?php |
| 58 | $matomo_tracking_caps = \WpMatomo\Settings::OPTION_KEY_STEALTH; |
| 59 | $matomo_filter = $settings->get_global_option( $matomo_tracking_caps ); |
| 60 | foreach ( $wp_roles->role_names as $matomo_key => $matomo_name ) { |
| 61 | echo '<input type="checkbox" ' . ( isset( $matomo_filter [ $matomo_key ] ) && $matomo_filter [ $matomo_key ] ? 'checked="checked" ' : '' ) . 'value="1" name="' . esc_attr( ExclusionSettings::FORM_NAME ) . '[' . esc_attr( $matomo_tracking_caps ) . '][' . esc_attr( $matomo_key ) . ']" /> ' . esc_html( $matomo_name ) . ' <br />'; |
| 62 | } |
| 63 | ?> |
| 64 | </td> |
| 65 | <td width="50%"> |
| 66 | <?php echo sprintf( esc_html__( 'Choose users by user role you do %1$snot%2$s want to track.', 'matomo' ), '<strong>', '</strong>' ); ?> |
| 67 | <?php if ($settings->is_network_enabled()) { ?> |
| 68 | <br><p><strong>This setting will be applied to all blogs. Changing it here also changes it for other blogs.</strong></p> |
| 69 | <?php } ?> |
| 70 | </td> |
| 71 | </tr> |
| 72 | <tr> |
| 73 | <th width="20%" scope="row"><label><?php echo esc_html( Piwik::translate( 'SitesManager_GlobalListExcludedIps' ) ); ?></label>: |
| 74 | </th> |
| 75 | <td width="30%"> |
| 76 | <?php echo sprintf( '<textarea cols="40" rows="4" id="%1$s" name="' . esc_attr( ExclusionSettings::FORM_NAME ) . '[%1$s]">%2$s</textarea>', 'excluded_ips', esc_html( $excluded_ips ) ); ?> |
| 77 | </td> |
| 78 | <td width="50%"> |
| 79 | <?php |
| 80 | echo Piwik::translate( |
| 81 | 'SitesManager_HelpExcludedIpAddresses', |
| 82 | array( |
| 83 | '1.2.3.4/24', |
| 84 | '1.2.3.*', |
| 85 | '1.2.*.*', |
| 86 | ) |
| 87 | ) |
| 88 | ?> |
| 89 | <br/> |
| 90 | <?php echo esc_html( Piwik::translate( 'SitesManager_YourCurrentIpAddressIs', esc_html( $current_ip ) ) ); ?> |
| 91 | </td> |
| 92 | </tr> |
| 93 | <tr> |
| 94 | <th scope="row"><label><?php echo esc_html( Piwik::translate( 'SitesManager_GlobalListExcludedQueryParameters' ) ); ?></label>: |
| 95 | </th> |
| 96 | <td> |
| 97 | <?php echo sprintf( '<textarea cols="40" rows="4" id="%1$s" name="' . esc_attr( ExclusionSettings::FORM_NAME ) . '[%1$s]">%2$s</textarea>', 'excluded_query_parameters', esc_html( $excluded_query_params ) ); ?> |
| 98 | </td> |
| 99 | <td> |
| 100 | <?php echo esc_html( Piwik::translate( 'SitesManager_ListOfQueryParametersToExclude', '/^sess.*|.*[dD]ate$/' ) ); ?> |
| 101 | <?php echo esc_html( Piwik::translate( 'SitesManager_PiwikWillAutomaticallyExcludeCommonSessionParameters', 'phpsessid, sessionid, ...' ) ); ?> |
| 102 | </td> |
| 103 | </tr> |
| 104 | <tr> |
| 105 | <th scope="row"><label><?php echo esc_html( Piwik::translate( 'SitesManager_GlobalListExcludedUserAgents' ) ); ?></label>: |
| 106 | </th> |
| 107 | <td> |
| 108 | <?php echo sprintf( '<textarea cols="40" rows="4" id="%1$s" name="' . esc_attr( ExclusionSettings::FORM_NAME ) . '[%1$s]">%2$s</textarea>', 'excluded_user_agents', esc_html( $excluded_user_agents ) ); ?> |
| 109 | </td> |
| 110 | <td> |
| 111 | |
| 112 | <?php echo esc_html( Piwik::translate( 'SitesManager_GlobalExcludedUserAgentHelp1' ) ); ?> |
| 113 | <br/> |
| 114 | <?php echo esc_html( Piwik::translate( 'SitesManager_GlobalListExcludedUserAgents_Desc' ) ); ?> |
| 115 | <?php echo esc_html( Piwik::translate( 'SitesManager_GlobalExcludedUserAgentHelp2' ) ); ?> |
| 116 | |
| 117 | </td> |
| 118 | </tr> |
| 119 | <tr> |
| 120 | <th scope="row"><label><?php echo esc_html( Piwik::translate( 'SitesManager_KeepURLFragmentsLong' ) ); ?></label>: |
| 121 | </th> |
| 122 | <td> |
| 123 | <?php echo sprintf( '<input type="checkbox" value="1" %2$s name="' . esc_attr( ExclusionSettings::FORM_NAME ) . '[%1$s]">', 'keep_url_fragments', $keep_url_fragments ? ' checked="checked"' : '' ); ?> |
| 124 | </td> |
| 125 | <td> |
| 126 | |
| 127 | <?php |
| 128 | echo Piwik::translate( |
| 129 | 'SitesManager_KeepURLFragmentsHelp', |
| 130 | array( |
| 131 | '<em>#</em>', |
| 132 | '<em>example.org/index.html#first_section</em>', |
| 133 | '<em>example.org/index.html</em>', |
| 134 | ) |
| 135 | ) |
| 136 | ?> |
| 137 | <br/> |
| 138 | <?php echo esc_html( Piwik::translate( 'SitesManager_KeepURLFragmentsHelp2' ) ); ?> |
| 139 | |
| 140 | </td> |
| 141 | </tr> |
| 142 | <tr> |
| 143 | <td colspan="3"> |
| 144 | <p class="submit"><input name="Submit" type="submit" class="button-primary" |
| 145 | value="<?php echo esc_attr__( 'Save Changes', 'matomo' ); ?>"/></p> |
| 146 | </td> |
| 147 | </tr> |
| 148 | |
| 149 | </tbody> |
| 150 | </table> |
| 151 | </form> |
| 152 | |
| 153 | <?php } ?> |