Reputation: 4125
I am having some trouble with my Google Tag Manager. The code is working great, but on the event the code is visible for the user! Example of the code shown in the browser
dataLayer.push({'event':'record','km_event':'logged in'....})
I haven't seen others with this issue and I can't understand where this is part of code is shown! The google tag manager code which I am using (header):
<!-- Google Tag Manager -->
<script>(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','---CODE---');</script>
<!-- End Google Tag Manager -->
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=--CODE---" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
Upvotes: 2
Views: 186
Reputation: 831
Clientside javascript is always visible! Even if you make a seperate .js file like you said, Javascript on the web is executed in a "sandbox environment" in the clients browser, so no matter what the code can always be seen.
Upvotes: 1