How to resolve the 404 error in indexing for the blog page due to extension

The http status of the blog page generates a 404 error when the banner and script extension is activated to the website.

The issue due to the Banner extension is resolved by updating where we are using the let so replace the let to var and replace the mountToApp: function mountToApp (container) to mountToApp: function() then deploy and do cache invalidation

Similarly,In  the script extension this issue is due to the using the let so replace the let to var and replace the mountToApp: function mountToApp (container) to mountToApp: function() then deploy and do cache invalidation there was an issue in the script so added the script in Site Management Tool

code below:

<script>
  var screiptsRecord = document.getElementsByTagName('script');
  var isScriptAvailable = false;
  _.each(screiptsRecord, (script)=>{
    if(script.src === 'https://www.googletagmanager.com/gtm.js?id=GTM-NPL9B2D'){
      isScriptAvailable = true;
    }
  });
  if(!isScriptAvailable){
      jQuery('head').append(jQuery(`<script> window.kwipped_approve = window.kwipped_approve || {}; window.kwipped_approve.url = "https://www.kwipped.com"; window.kwipped_approve.approve_id = "eyJpdiI6IkZpOUE3UFBrWlhFdzZ0S2duM0NqSFE9PSIsInZhbHVlIjoiYVFrZUE2V2xWZ0d5ZEMrZllGdW1kZz09IiwibWFjIjoiYTRkZTk4N2NlNmVlNTc3MDg4MmQ1NjViZDU4MmQ1OGY0ZjMyYmExMzU2Yjk3MzNjM2RkNDk3ZTk4MWRhNDU4OCJ9"; function init_kwipped_approve_snippet() { var b = document.getElementsByTagName('body')[0]; var t = document.querySelector('approve-widget'); if (!t) { t = document.createElement('approve-widget'); b.appendChild(t); } var s=document.createElement('script'); s.type= 'text/javascript'; s.src = 'https://api.kwipped.com/approve/plugin/3.0/approve_plugin_loader.php'; b.appendChild(s); } if(document.readyState != 'loading'){ init_kwipped_approve_snippet(); } else{ window.addEventListener('DOMContentLoaded',init_kwipped_approve_snippet); } <\/script>`));

 

      jQuery('head').append(jQuery(`<!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-NTGXMW4NGD"><\/script><script> window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-NTGXMW4NGD'); <\/script>`));

 

      jQuery('head').append(jQuery('<script>').text("(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})"+"(window,document,'script','dataLayer','GTM-NPL9B2D');"));

 

      jQuery('body').append('<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NPL9B2D" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>');
  }

</script>

Leave a comment

Your email address will not be published. Required fields are marked *