Where does the Google Analytics Code go?

I am totally blanking here. Where do I put the universal Google Analytics code? Is there a special field somewhere in the theme settings? Something else? I seem to remember such fields in other themes I’ve used, but again, I’m drawing a blank.

Thanks!

Perhaps I need to use a plugin like Google Analytics Dashboard for WP or one of the other ones that come up when I search for Google Analytics in the WP plugin directory? Just wanted to make sure I wasn’t missing something in the BB settings.

Hi Daniel,
In Appearance >> Customizer
you will see a Code section
Paste your code into the Javascript section and click the save button
(Note: It does not look very pretty in the form, and wraps around and looks ugly, but as long as you have pasted it from a plain text origin (ie not word), it should be fine)
HTH, Dave

Excellent! Thanks for the help.

My pleasure…
Have a great weekend

Hi Dave,

First, thanks for responding to Daniel’s question. I was looking for this information and your response was exactly what I needed. :slight_smile:

Quick question (if you have time)…

I’ve inserted the Google Analytics javascript code as you advised. I’ve confirmed that the code is now on every blog post and nearly every page on my site. For some reason, however, there are two pages (not posts) that lack the code.

Do you know how I can insert the JS code into those two pages? Is there a way to do so individually - i.e. add the code on the page level rather than site level?

Happy 4th!

Damon

Hey Damon,

Do you mind sharing the URL of this site and the pages it didn’t have the GA code on?

Ben

Hi Ben!

Thanks for your reply. I just checked the two pages in question and the JS code is now there. I know that makes me sound like a knucklehead, but I checked it several times.

I may have been looking at a cached version of source code.

In any case, everything looks great. Sorry for the false alarm and thanks again for offering assistance. I appreciate it. :slight_smile:

By the way, BB rocks!

Damon

Hey Damon,

It indeed could be a cached version of the page you were seeing. Anyway, just glad that everything is working fine! Have fun with The Beaver! :slight_smile:

Ben

Hi, i did exactly like said above, put the following code to JS section, but it is not working, doesn’t show real time visitors.

<script>
(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,‘script’,’//www.google-analytics.com/analytics.js’,'ga’);

ga(‘create’, ‘UA-REPLACED’, ‘auto’);
ga(‘send’, ‘pageview’);

</script>

Hey Pärt,

Do you mind sharing the URL of the site so we can check if the code is there?

Ben

[Content Hidden]

Hey Pärt,

You can actually remove the <script> tags as those are automatically added when you place a code inside the JS Code section. Try that and see if it works!

Ben

Superb, thanks!

No worries! Have fun! :slight_smile:

Ben