i have installed many third party scripts on a web page. few of them are google analytics, facebook pixel, bing tracking, google ads tracking and few more. all of them provide a block of script and noscript codes. for example: bing tracking codes
<script>
(function(w,d,t,r,u){
var f,n,i;w[u]=w[u]||[],f=function(){
var o={ti:"5709384"};o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")},
n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function(){
var s=this.readyState;s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)
},i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})(window,document,"script","//bat.bing.com/bat.js","uetq");
</script>
<noscript><img src="//bat.bing.com/action/0?ti=5709384&Ver=2" height="0" width="0" style="display:none; visibility: hidden;" /></noscript>
And facebook pixel codes
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window,document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '756756745676');
fbq('track', 'PageView');
</script>
<noscript>
<img height="1" width="1"
src="https://www.facebook.com/tr?id=756756745676&ev=PageView
&noscript=1"/>
</noscript>
now my concern is do we need to add all noscript tags. would it be good if i remove all noscript tags and place a single noscript tag with a message to turn on javascript. or may be i got the wrong idea about noscript tags. Please advise.
You should NOT remove the <noscript>
tags if they are explicitly provided to you, especially with Facebook Pixel, Google Tag Manger and the likes.
For normal users (who have scripting turned on by default), normal <script>
tags will run and your third-party tracking tools will run as expected, thus properly contribute to your analytics.
However, for some users who have their scripting turned off, normal <script>
tags won't run, thus your analytics will not be accurate anymore. This is where <noscript>
come into play.
If you noticed, the <noscript>
provided by these third-party analytics have an <iframe>
or <img>
with a src
attribute along with your "app_id". With Facebook Pixel and GTM, you will also see something like "PageView" or the likes in the attribute.
Whenever the <iframe>
or <img>
with the src
is loaded, a page view count is attributed to your tracking ID.
So, in the event where scripting is turned off, <noscript>
will now function to track your web performance, making your analytics more accurate (even though some advanced tracking features is not possible).