[Support request] How to Add Google Analytics Code to Generate Press

Home Forums Support [Support request] How to Add Google Analytics Code to Generate Press

Home Forums Support How to Add Google Analytics Code to Generate Press

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #770996
    Monica

    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

    #771014
    Marcus

    Download plugin “header and footer” and then add the code in header ๐Ÿ™‚

    #771033
    Monica

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

    #771152
    Patrick

    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.

    #771191
    Monica

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

    #771208
    Tom
    Lead Developer
    Lead 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_head hook and set your Display Rules ๐Ÿ™‚

    #771386
    Patrick

    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.

    #1123190
    Robi

    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?

    #1123300
    David
    Staff
    Customer Support

    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.

    #1275828
    Ish Kumar

    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?

    #1276039
    Tom
    Lead Developer
    Lead Developer

    Shouldn’t take long. Maybe something like this will help: http://www.gachecker.com/

    #1296121
    nutt

    Just about what I am looking for

    #1309527
    Quentin

    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

    #1309666
    David
    Staff
    Customer Support

    Hi there,

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

    #1340179
    Elmehdi

    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?

Viewing 15 posts - 1 through 15 (of 20 total)
  • You must be logged in to reply to this topic.