Site logo

Archived topic

How to Add Google Analytics Code to Generate Press

19 replies · Started by Monica on January 2, 2019

Viewing posts 1–15 of 20

I am trying to find documentation to walk me through the steps on how to add the Google Analytics tracking code to my Generate Press theme. Thanks

Download plugin "header and footer" and then add the code in header :)

Thanks Marcus. I was reading there was something inside GeneratePress where I can add it? Hooks? elements? Was looking for steps for it.

Hi Monica, I used a GP hook to add my tracking code (actually Google Tag Manager). You can generate the tracking code, then use the "head" and "body" hooks to insert the JS.

Thanks Patrick. Do you know if there is documentation or steps on how to add it?

Monica, as far as generating the GA code itself, here's some documentation. Google Tag Manager is a little more involved: You have to install the GTM container in the header/body, then create a tag that tracks all pageviews using your GA code. However, if you plan on adding more than one tag (like the Facebook pixel, or some sort of event tracking), GTM is probably worth it.

Hello Tom. I used a hook to paste the code and followed all the instructions mentioned. But it did not work. But the problem was fixed when I used the header and footer plugin. But I would still want to achieve the same using hook inside GP. Any way to do so? Is there anything I did wrong? But I believe I did exactly what was mentioned on that instructional video - hooks-element-overview.Does it take time to reflect the changes using hook?

Hi there,

never had any issues with using the GP Hook Element for adding Google Analytics.

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.

For GTM only - the second code is added like so:

1. Create another new Hook.
2. Add the scond GTM Script.
3. Select wp_body_open hook from the list
4. Set Display Rules for Entire site.

Hi David,

I have added same code as mentioned by you to add Google Analytics, but still can't see the results in analytics page. How much time we should wait?

Just about what I am looking for

Hi,

I did it exactly the way David mentioned above. Added the tracking code and after a few minutes google analytics showed activity in the stats. But when I am using GA Checker I just see ticks at "global site tags" on all tested URL's but the other 3 options next to it are red crossed.

Is it ok or do I have to do anything else?

Thank you very much

Hi there,

if you have only added the GTM tags then that is correct.

I've gone to my google analytics>admin>tracking code>and copy pasted the gtag in there into the hook element as suggested. However, the only results I get is who entered my site and from where. Any engaging happen like clicking links it doesn't show up at all...can you help me?

This archived topic is closed to new replies.