Skip to content

Commit 7e9554e

Browse files
authored
Merge pull request #261 from plausible/default_enhanced_measurements
Added: Enhanced Measurements 404, File downloads, Outbound links, Form completions and Search queries are now enabled by default.
2 parents 2f3e7ee + 7ab4245 commit 7e9554e

File tree

3 files changed

+2
-28
lines changed

3 files changed

+2
-28
lines changed

src/Admin/Settings/API.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function settings_page() {
8989
'Would you like to view your site\'s stats in your WordPress dashboard?',
9090
'plausible-analytics'
9191
),
92-
'enhanced_measurements' => __( 'Enable enhanced measurements', 'plausible-analytics' ),
92+
'enhanced_measurements' => __( 'Enable enhanced measurements.', 'plausible-analytics' ),
9393
'proxy_enabled' => __(
9494
'Run our script as a first party connection from your domain name to count visitors who use ad blockers',
9595
'plausible-analytics'

src/Admin/Upgrades.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ public function run() {
6060
$this->upgrade_to_126();
6161
}
6262

63-
if ( version_compare( $plausible_analytics_version, '1.3.1', '<' ) ) {
64-
$this->upgrade_to_131();
65-
}
66-
6763
if ( version_compare( $plausible_analytics_version, '1.3.2', '<' ) ) {
6864
$this->upgrade_to_132();
6965
}
@@ -116,9 +112,6 @@ public function upgrade_to_125() {
116112
unset( $new_settings[ 'is_custom_domain' ] );
117113
}
118114

119-
// Enable Outbound links by default.
120-
$new_settings[ 'enhanced_measurements' ] = [ 'outbound-links' ];
121-
122115
if ( ! empty( $old_settings[ 'track_administrator' ] ) && $old_settings[ 'track_administrator' ] === 'true' ) {
123116
$new_settings[ 'tracked_user_roles' ] = [ 'administrator' ];
124117
}
@@ -148,25 +141,6 @@ public function upgrade_to_126() {
148141
update_option( 'plausible_analytics_version', '1.2.6' );
149142
}
150143

151-
/**
152-
* Upgrade to 1.3.1
153-
* - Enables 404 pages tracking by default.
154-
*
155-
* @return void
156-
* @codeCoverageIgnore
157-
*/
158-
public function upgrade_to_131() {
159-
$settings = Helpers::get_settings();
160-
161-
if ( ! in_array( '404', $settings[ 'enhanced_measurements' ], true ) ) {
162-
array_unshift( $settings[ 'enhanced_measurements' ], '404' );
163-
}
164-
165-
update_option( 'plausible_analytics_settings', $settings );
166-
167-
update_option( 'plausible_analytics_version', '1.3.1' );
168-
}
169-
170144
/**
171145
* Upgrade to 1.3.2
172146
* - Updates the Proxy Resource, Cache URL to be protocol relative.

src/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static function get_settings() {
9292
$defaults = [
9393
'domain_name' => '',
9494
'api_token' => '',
95-
'enhanced_measurements' => [],
95+
'enhanced_measurements' => [ '404', 'file-downloads', 'form-completions', 'search', 'outbound-links' ],
9696
'affiliate-links' => [],
9797
'proxy_enabled' => '',
9898
'enable_analytics_dashboard' => '',

0 commit comments

Comments
 (0)