| @@ -118,9 +118,13 @@ | ||
| 118 | 118 | * @param String $handle handle. |
| 119 | 119 | */ |
| 120 | 120 | public function add_id_to_tracking_code( $tag, $handle ) { |
| 121 | 121 | if ( AssetsManager::TRACKING_CODE === $handle ) { |
| 122 | - $tag = str_replace( "id='" . $handle . "-js'", "async defer id='hs-script-loader'", $tag ); | |
| 122 | + $tag = preg_replace( | |
| 123 | + '/id=[\'"]' . preg_quote( $handle . '-js', '/' ) . '[\'"]/', | |
| 124 | + "async defer id='hs-script-loader'", | |
| 125 | + $tag | |
| 126 | + ); | |
| 123 | 127 | } |
| 124 | 128 | return $tag; |
| 125 | 129 | } |
| 126 | 130 | |