access.php
7 months ago
adblocker-notice.php
7 months ago
advanced_settings.php
10 months ago
exclusion_settings.php
4 years ago
geolocation_settings.php
2 years ago
get_started.php
2 months ago
import_wp_statistics.php
2 months ago
info.php
2 months ago
info_bug_report.php
2 years ago
info_help.php
1 year ago
info_high_traffic.php
2 years ago
info_matomo_desc.php
1 year ago
info_multisite.php
2 months ago
info_newsletter.php
4 years ago
info_shared.php
1 year ago
marketplace.php
3 months ago
marketplace_setup_wizard.php
3 months ago
marketplace_setup_wizard_body.php
3 months ago
measurable_settings.php
2 years ago
privacy_gdpr.php
4 years ago
scheduled_tasks_failures.php
2 years ago
settings.php
2 months ago
settings_errors.php
4 years ago
summary.php
2 months ago
systemreport.php
2 months ago
tracking.php
4 months ago
update_notice_clear_cache.php
5 years ago
whats-new-notifications.php
1 year ago
advanced_settings.php
123 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 | * https://github.com/braekling/WP-Matomo |
| 11 | * |
| 12 | */ |
| 13 | /** |
| 14 | * phpcs consider all our variables as global and want them prefixed with matomo |
| 15 | * phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound |
| 16 | */ |
| 17 | use WpMatomo\Admin\AdvancedSettings; |
| 18 | |
| 19 | if ( ! defined( 'ABSPATH' ) ) { |
| 20 | exit; |
| 21 | } |
| 22 | /** @var bool $was_updated */ |
| 23 | /** @var string $matomo_detected_ip */ |
| 24 | /** @var array $matomo_client_headers */ |
| 25 | /** @var int $matomo_server_side_tracking_delay */ |
| 26 | ?> |
| 27 | |
| 28 | <?php |
| 29 | if ( $was_updated ) { |
| 30 | include 'update_notice_clear_cache.php'; |
| 31 | } |
| 32 | ?> |
| 33 | <form method="post"> |
| 34 | <?php wp_nonce_field( AdvancedSettings::NONCE_NAME ); ?> |
| 35 | |
| 36 | <p><?php esc_html_e( 'Advanced settings', 'matomo' ); ?></p> |
| 37 | <table class="matomo-tracking-form widefat"> |
| 38 | <tbody> |
| 39 | <tr> |
| 40 | <th width="20%" scope="row"><label |
| 41 | for="matomo[proxy_client_header]"><?php esc_html_e( 'Proxy IP headers', 'matomo' ); ?>:</label> |
| 42 | </th> |
| 43 | <td> |
| 44 | <?php |
| 45 | echo '<span style="white-space: nowrap;display: inline-block;"><input type="radio" ' . ( empty( $matomo_client_headers ) ? 'checked="checked" ' : '' ) . ' value="REMOTE_ADDR" name="matomo[proxy_client_header]" /> <code>REMOTE_ADDR</code> ' . ( ! empty( $_SERVER['REMOTE_ADDR'] ) ? esc_html( sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) ) : esc_html__( 'No value found', 'matomo' ) ) . ' (' . esc_html__( 'Default', 'matomo' ) . ')</span>'; |
| 46 | foreach ( AdvancedSettings::$valid_host_headers as $host_header ) { |
| 47 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 48 | echo '<span style="white-space: nowrap;display: inline-block;"><input type="radio" ' . ( in_array( $host_header, $matomo_client_headers, true ) ? 'checked="checked" ' : '' ) . 'value="' . esc_attr( $host_header ) . '" name="matomo[proxy_client_header]" /> <code>' . esc_html( $host_header ) . '</code> ' . ( ! empty( $_SERVER[ $host_header ] ) ? ( '<strong>' . esc_html( sanitize_text_field( wp_unslash( $_SERVER[ $host_header ] ) ) ) . '</strong>' ) : esc_html__( 'No value found', 'matomo' ) ) . ' </span>'; |
| 49 | } |
| 50 | ?> |
| 51 | </td> |
| 52 | <td width="50%"> |
| 53 | <?php esc_html_e( 'We detected you have the following IP address:', 'matomo' ); ?> |
| 54 | <?php echo esc_html( $matomo_detected_ip ); ?> <br> |
| 55 | <?php echo sprintf( esc_html__( 'To compare this value with your actual IP address %1$splease click here%2$s.', 'matomo' ), '<a rel="noreferrer noopener" target="_blank" href="https://matomo.org/ip.php">', '</a>' ); ?> |
| 56 | <br><br> |
| 57 | <?php esc_html_e( 'Should your IP address not match the above value, your WordPress might be behind a proxy and you may need to select a different HTTP header depending on which of the values on the left shows your correct IP address.', 'matomo' ); ?> |
| 58 | </td> |
| 59 | </tr> |
| 60 | <?php if ( ! defined( 'MATOMO_REMOVE_ALL_DATA' ) ) { ?> |
| 61 | <tr> |
| 62 | <th width="20%" scope="row"><label |
| 63 | for="matomo[delete_all_data]"><?php esc_html_e( 'Delete all data on uninstall', 'matomo' ); ?> |
| 64 | :</label> |
| 65 | </th> |
| 66 | <td> |
| 67 | <?php |
| 68 | echo '<span style="white-space: nowrap;display: inline-block;"><input type="checkbox" ' . ( ! empty( $matomo_delete_all_data ) ? 'checked="checked" ' : '' ) . ' value="1" name="matomo[delete_all_data]" /> ' . esc_html__( 'Yes', 'matomo' ) . '</span>'; |
| 69 | ?> |
| 70 | </td> |
| 71 | <td width="50%"> |
| 72 | <?php esc_html_e( 'By default, when you uninstall the Matomo plugin, all data is deleted and cannot be restored unless you have backups. When you disable this feature, the tracked data in the database will be kept. This can be useful to prevent accidental deletion of all your historical analytics data when you uninstall the plugin.', 'matomo' ); ?> <a |
| 73 | href="https://matomo.org/faq/wordpress/how-do-i-delete-or-reset-the-matomo-for-wordpress-data-completely/" |
| 74 | target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Learn more', 'matomo' ); ?></a> |
| 75 | </td> |
| 76 | </tr> |
| 77 | <?php } ?> |
| 78 | <tr> |
| 79 | <th width="20%" scope="row"> |
| 80 | <label for="matomo[disable_async_archiving]"><?php esc_html_e( 'Enable archiving via HTTP requests', 'matomo' ); ?>:</label> |
| 81 | </th> |
| 82 | <td> |
| 83 | <span style="white-space:nowrap;display: inline-block;"> |
| 84 | <input type="checkbox" <?php echo ! empty( $matomo_disable_async_archiving ) || empty( $matomo_async_archiving_supported ) ? 'checked="checked" ' : ''; ?> value="1" name="matomo[disable_async_archiving]" |
| 85 | id="matomo[disable_async_archiving]" <?php echo ! empty( $matomo_async_archiving_supported ) ? '' : 'disabled="disabled"'; ?> |
| 86 | /> |
| 87 | </span> |
| 88 | </td> |
| 89 | <td width="50%"> |
| 90 | <?php |
| 91 | echo ! empty( $matomo_async_archiving_supported ) |
| 92 | ? esc_html_e( 'If you are experiencing trouble with archiving (as in, report generation), enabling this option may solve the issue.', 'matomo' ) |
| 93 | : esc_html_e( 'CLI archiving (aka async archiving) is not supported for your server, so archiving via HTTP requests is always enabled.', 'matomo' ); |
| 94 | ?> |
| 95 | </td> |
| 96 | </tr> |
| 97 | <tr> |
| 98 | <th width="20%" scope="row"> |
| 99 | <label for="matomo_server_side_tracking_delay_secs"> |
| 100 | <?php esc_html_e( 'Server side tracking delay', 'matomo' ); ?>: |
| 101 | </label> |
| 102 | </th> |
| 103 | <td scope="row"> |
| 104 | <input id="matomo_server_side_tracking_delay_secs" type="number" |
| 105 | name="matomo[server_side_tracking_delay_secs]" |
| 106 | value="<?php echo esc_attr( $matomo_server_side_tracking_delay ); ?>" /> |
| 107 | </td> |
| 108 | <td width="50%"> |
| 109 | <?php esc_html_e( 'Number of seconds delay before server side tracking is executed.', 'matomo' ); ?> |
| 110 | <br/><br/> |
| 111 | <?php esc_html_e( 'When E-commerce events like cart updates and orders occur during AJAX or REST requests they must be tracked using server side tracking.', 'matomo' ); ?> |
| 112 | <?php esc_html_e( 'Server side tracking, however, can result in less useful data, so before doing it Matomo will try to use JavaScript tracking on the next pageview.', 'matomo' ); ?> |
| 113 | <?php esc_html_e( 'If no page view occurs, then server side tracking is used. This setting controls how long Matomo waits before deciding to do server side tracking.', 'matomo' ); ?> |
| 114 | </td> |
| 115 | </tr> |
| 116 | <tr> |
| 117 | <td colspan="3"><p class="submit"><input name="Submit" type="submit" class="button-primary" |
| 118 | value="<?php esc_attr_e( 'Save Changes', 'matomo' ); ?>"/></p></td> |
| 119 | </tr> |
| 120 | </tbody> |
| 121 | </table> |
| 122 | </form> |
| 123 |