File tree 2 files changed +24
-3
lines changed
2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ public static function get_filename( $local = false ) {
67
67
}
68
68
69
69
if ( ! self ::is_enhanced_measurement_enabled ( 'pageview-props ' ) && self ::is_enhanced_measurement_enabled ( 'search ' ) ) {
70
- $ file_name .= '.pageview-props ' ;
70
+ $ file_name .= '.pageview-props ' ; // @codeCoverageIgnore
71
71
}
72
72
73
73
// Load exclusions.js if any excluded pages are set.
@@ -76,8 +76,8 @@ public static function get_filename( $local = false ) {
76
76
}
77
77
78
78
// Add the manual scripts as we need it to track the search parameter.
79
- if ( is_search ( ) ) {
80
- $ file_name .= '.manual ' ;
79
+ if ( self :: is_enhanced_measurement_enabled ( ' search ' ) ) {
80
+ $ file_name .= '.manual ' ; // @codeCoverageIgnore
81
81
}
82
82
83
83
return $ file_name ;
Original file line number Diff line number Diff line change @@ -86,6 +86,14 @@ public function testGetFilename() {
86
86
remove_filter ( 'plausible_analytics_integrations_woocommerce ' , '__return_true ' );
87
87
88
88
$ this ->assertEquals ( 'plausible.revenue.tagged-events ' , $ filename );
89
+
90
+ add_filter ( 'plausible_analytics_settings ' , [ $ this , 'enableSearch ' ] );
91
+
92
+ $ filename = Helpers::get_filename ();
93
+
94
+ $ this ->assertEquals ( 'plausible.pageview-props.manual ' , $ filename );
95
+
96
+ remove_filter ( 'plausible_analytics_settings ' , [ $ this , 'enablePageviewProps ' ] );
89
97
}
90
98
91
99
/**
@@ -127,6 +135,19 @@ public function enableRevenue( $settings ) {
127
135
return $ settings ;
128
136
}
129
137
138
+ /**
139
+ * Enable Enhanced Measurements > Search Queries
140
+ *
141
+ * @param $settings
142
+ *
143
+ * @return mixed
144
+ */
145
+ public function enableSearch ( $ settings ) {
146
+ $ settings [ 'enhanced_measurements ' ] = [ 'search ' ];
147
+
148
+ return $ settings ;
149
+ }
150
+
130
151
/**
131
152
* @see Helpers::get_settings()
132
153
*
You can’t perform that action at this time.
0 commit comments