- This topic has 19 replies, 4 voices, and was last updated 2 years ago by David.
January 2, 2019 at 5:53 am #770996Monica
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. ThanksGeneratePress 2.2.1GP Premium 1.7.7January 2, 2019 at 6:25 am #771014Marcus
Download plugin “header and footer” and then add the code in header 🙂January 2, 2019 at 6:44 am #771033Monica
Thanks Marcus. I was reading there was something inside GeneratePress where I can add it? Hooks? elements? Was looking for steps for it.January 2, 2019 at 6:53 am #771152Patrick
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.January 2, 2019 at 7:38 am #771191Monica
Thanks Patrick. Do you know if there is documentation or steps on how to add it?January 2, 2019 at 8:03 am #771208TomLead DeveloperLead Developer
You can add it using the Hook Element: https://docs.generatepress.com/article/hooks-element-overview/
Add your tracking code, then choose the
wp_headhook and set your Display Rules 🙂January 2, 2019 at 11:13 am #771386Patrick
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.January 5, 2020 at 11:09 pm #1123190Robi
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?January 6, 2020 at 2:33 am #1123300DavidStaffCustomer Support
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.
wp_headhook 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.
wp_body_openhook from the list
4. Set Display Rules for Entire site.May 8, 2020 at 12:21 pm #1275828Ish Kumar
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?May 8, 2020 at 4:08 pm #1276039TomLead DeveloperLead DeveloperMay 21, 2020 at 7:48 pm #1296121nutt
Just about what I am looking forJune 1, 2020 at 2:30 am #1309527Quentin
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 muchJune 1, 2020 at 4:46 am #1309666DavidStaffCustomer SupportJune 24, 2020 at 7:32 am #1340179Elmehdi
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?
- You must be logged in to reply to this topic.