How to Unknown Google Tag Manager Code Remove from Site ?

SEO Help and Tips

How to Unknown Google Tag Manager Code Remove from Site ?

Highlighting the Script Element:
If you want to visually highlight the script element, you can add a border or background color to it. Here's a sample code snippet to do that:

<div id="googleOptimizeContainer">
  <script id="myGoogleOptimizeScript" src="https://www.googleoptimize.com/optimize.js?id=OPT-THWN2PQ"></script>
</div>

<style>
  #googleOptimizeContainer {
    background-color: yellow;
  }
</style>

Or,

<script id="myGoogleOptimizeScript" src="https://www.googleoptimize.com/optimize.js?id=OPT-THWN2PQ"></script>

<script>
  //<![CDATA[ 
// JavaScript to highlight the script element
const scriptElement = document.getElementById('myGoogleOptimizeScript');

if (scriptElement) {
  scriptElement.style.border = '2px solid red'; // Add a red border to highlight the script element
}
  //]]>
</script>


Removing the Script Element:
If you want to remove the script element from the DOM, you can use the following code:

<script id="myGoogleOptimizeScript" src="https://www.googleoptimize.com/optimize.js?id=OPT-THWN2PQ"></script>

<script>
  //<![CDATA[ 
// JavaScript to remove the script element
const scriptElement = document.getElementById('myGoogleOptimizeScript');

if (scriptElement) {
  scriptElement.parentNode.removeChild(scriptElement); // Remove the script element from its parent
}
  //]]>
</script>


Here's an example of how you can disable the Google Optimize script using JavaScript:

<!-- Add the Google Optimize script -->
<script id="myGoogleOptimizeScript" src="https://www.googleoptimize.com/optimize.js?id=OPT-THWN2PQ"></script>

<script>
  // JavaScript to disable the Google Optimize script
  const scriptElement = document.getElementById('myGoogleOptimizeScript');

  if (scriptElement) {
    // Remove the script element from the DOM to disable it
    scriptElement.parentNode.removeChild(scriptElement);
  }
</script>

Comments

Popular posts from this blog

Office Tool_SPSS v23 + Serial key

How to Fix FATAL error Failed to parse input Document ?

How to Reduce Lazy Load Resources

Popular posts from this blog

Office Tool_SPSS v23 + Serial key

How to Fix FATAL error Failed to parse input Document ?

How to Reduce Lazy Load Resources