Site logo

Archived topic

Adding Google Analytics Code To Header

5 replies · Started by Michael on April 8, 2021

Viewing posts 1–6 of 6

Hello,

Just a quick question about adding the Google Analytics code.

I searched the forum for previous posts and I found these instructions:

1. Appearance > Elements > New > Hook.
2. Add your GA Script or the first GTM Script.
3. Select wp_head hook from the list
4. Set Display Rules for Entire site.

I have never heard of hooks before seeing this instruction, so I just wanted to make sure I'm doing it right!

I can see the post interface when adding this, so my questions were:

- When I've added the GA code here, do I just click publish?
- Do I set it to public or private?

Thanks!

Michael

Hi Michael,

– When I’ve added the GA code here, do I just click publish?

Yes :)

– Do I set it to public or private?

Public.

Done it!

Thanks,

Michael

No problem :)

I've more Google code to add, but I need to remember how to add it! To head in all pages,

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

gtag('config', 'AW-1072711480');
</script>

Hi there,

go to Appearance > Elements
Add New -> Hook.
Add your code to the Text Area.
Set the Hook to wp_head
Set the Display Rules to Entire Site

This archived topic is closed to new replies.