Skip to content

Commit ca23f2f

Browse files
committed
Only change JS ID if IE compatibility is enabled.
1 parent 64d505e commit ca23f2f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Filters.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ public function add_plausible_attributes( $tag, $handle ) {
5151
$api_url = Helpers::get_data_api_url();
5252
$domain_name = Helpers::get_domain();
5353

54-
// We need the correct id attribute for IE compatibility.
55-
$tag = preg_replace( "/\sid=(['\"])plausible-analytics-js(['\"])/", " id=$1plausible$2", $tag );
54+
if ( Helpers::is_enhanced_measurement_enabled( 'compat' ) ) {
55+
// We need the correct id attribute for IE compatibility.
56+
$tag = preg_replace( "/\sid=(['\"])plausible-analytics-js(['\"])/", " id=$1plausible$2", $tag );
57+
}
58+
5659
/**
5760
* the data-cfasync ensures this script isn't processed by CF Rocket Loader @see https://developers.cloudflare.com/speed/optimization/content/rocket-loader/ignore-javascripts/
5861
*/

0 commit comments

Comments
 (0)