0

I've pasted my GA tracking code using a wordpress plugin called "insert headers and footers" and I can see my data in GA panel. But my problem is that the code is being shown on top of my home page and want to remove it from there. what should i do?

  • What does "shown" mean? Do you mean that it is visible to users, or do you mean that the code is in the source code of the home page and you want to remove it from that particular page? – Stephen Ostermiller Feb 22 at 11:40
  • it is visible to users. – Joseph Feb 22 at 19:19
  • 1
    That means it isn't properly installed. I don't know anything about that particular insertion plugin. I've used "Google Analytics for WordPress by MonsterInsights" plugin before and gotten it to work. – Stephen Ostermiller Feb 22 at 20:59
  • I tried out the Headers and Footers plugin about two years back, and it worked well. I'd check if it's still actively supported; try a similar plugin, as WP has a few that do the same thing; and also make sure you pasted the whole GA snippet and there aren't any tags or brackets missing. – Henry Visotski Feb 22 at 21:26
  • Can you give us a link to your site ? – François Huppé Feb 22 at 23:24
1

The tracking code that you need to paste in the header should look similar to this

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-TRACKINGID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'UA-TRACKINGID');
</script>

Not just the tracking ID.

Since the text is within <script></script> it should not be displayed on the front-end.

You can find this tracking code in Google Analytics > Admin (Gear Icon) > under Property Tracking info > Tracking Code

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.