0

Can anyone help me recognize how this code is implementing GA? This isn't the classic GA code you'd apply to a page, nor is it something you'd implement via Google Tag Manager. I'm considering if I even need it, but I don't know where it's coming from... (Note I made the UA- ID 000000 on purpose.)

<!-- Google Analytics Code -->
<script type="text/javascript">
   var googleAccount = "UA-000000-2";
   var tracking_memberType = "Anonymous";
   dataLayer.push({'event': 'standardGatc'});
   dataLayer.push({'event': 'gaEcommerceDone'});
</script>
2
  • The code listed doesn't do anything by itself in terms of tracking. It sets a GA account ID into a variable, and also a member type variable, and then pushes one "event" value into the dataLayer, but then overwrites that same value by pushing another into it (you can only have one dataLayer parameter of the same name at any one time). Is there some other script that uses some of those variables? – nyuen Mar 31 '15 at 21:39
  • Any updates OP? – nyuen May 24 '15 at 5:34
1

Without the main Google Analytics javascript file from the analytics servers being inserted into the page as well this code will do absolutely nothing. Even the dataLayer.push method will not do anything as the code is trying to call the dataLayer.push() function and if the analytics main code isn't imported into the page that function does not exist at all and so would be throwing errors in your javascript console.

If you are not trying to add Google Analytics or you don't have the main Google Analytics script file added to your page then you can safely remove this script block from your page without any risk.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.