Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #1260421

    hello,
    i really find most of Google Analytics over my head, but it’s been useful for the basics. last time i did an Enfold site, i created the GA account, copy/pasted the provided code, and within a day it started showing data.

    now, i need to do the same thing for a new site, so i followed my previous pattern. but now, apparently Google Analytics has been upgraded to version 4 and it’s COMPLETELY different & utterly confusing. but, i forged thru, following the prompts & instructions, created the account & “property”, got to the new code it provides, copy/pasted into Enfold, but it’s been a few days and nothing yet.

    so i started investigating as best i can. i searched the pages codes via Chrome’s Inspector but cannot find the GA code anywhere.
    i installed the GA extension for Chrome to troubleshooot, but it too is not finding any of the GA code.
    i’ve followed a lot of tutorials to make sure i setup GA properly. i THINK i have.
    so that leaves the question – is GA 4 compatible with Enfold?

    here’s a screenshot of my code. i tried both just inserting the tracking ID (didn’t work either) as well as what you see. hoping for some help please.

    View post on imgur.com

    #1260498

    Same issue is here.

    Standard UA-XXXXXX codes works perfectly but if I try to change G-XXXXXXX is not working.

    Suprisingly if I copy/paste gtag with G-XXXXX its not accepting this too.

    example code:

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

    From now on you cant create old kind (UA) tracking codes, it produces new format. Please release a fix for it.

    Thanks

    #1260532

    yup, it would seem that as of Enfold version 4.7.6.4, does not support the new Google Analytics 4.
    BUT,
    it is possible to create the old “Universal” Google Analytics still…
    https://support.google.com/analytics/answer/9304153?hl=en#UA

    i just did that, got the “UA-xxxxxxx” number rather than the “G-xxxxxxx” number; used the code provided and it looks to be working (according to the Google Analytics Chrome Extension) – will have to see after a day or so to see if the data starts rolling in.
    (FYI)

    #1260568

    Hi,

    Sorry for the problem. The new analytics format won’t work in the Analytics box in the current version of the theme. This has been reported to our developers, and a solution should be in place with the next release of the theme. Until then, please use a function in functions.php to add your tracking code:

    function new_analytics_code(){
    ?>
    Your tracking code goes here
    <?php
    }
    add_action('wp_head', 'new_analytics_code');

    Best regards,
    Rikard

    #1261323

    functions.php in wp-includes or in Enfold?

    #1261327

    Hey,

    Functions.php file in Enfold. You can edit the file in Appearance > Editor.

    Best regards,
    Yigit

    #1261328

    So all this?

    function new_analytics_code(){
    ?>
    <!– Global site tag (gtag.js) – Google Analytics –>
    <script async src=”https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXX”></script&gt;
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag(‘js’, new Date());

    gtag(‘config’, ‘G-XXXXXXXXXX’);
    </script>
    <?php
    }
    add_action(‘wp_head’, ‘new_analytics_code’);

    #1261330

    Works a treat – thank you!

    • This reply was modified 4 years, 1 month ago by whdsolutions.
    #1261468

    Hi whdsolutions,

    Great, I’m glad that you got it working :-)

    Best regards,
    Rikard

    #1308940

    Big problem with this solution is that then cookie logic no longer controls the analytics!

    All Google Tag Manager codes don’t work using Enfold Analytics logic, This means the theme breaks European laws and cannot be used!

    #1309026

    Hi BruceJackson,

    This should work as expected in the latest version of the theme, could you try updating to that please? https://kriesi.at/documentation/enfold/how-to-install-enfold-theme/#theme-update.

    Best regards,
    Rikard

    #1413061

    Hi Rikard, I am having problems with the GA4 cookie as well. I think it is still not recognized.
    I copied the whole GA4-Stream-Tag from google to the field in the google service tab of the options.

    In the cookie-modal I can not select the google analytics cookie and I also can’t select the GA-related cookies in the other cookies tab. Do you have an idea?

    EDIT: If you find the code in the source: I added the script through functions.php (add_action(‘wp_head’), but this is not how it should be.

    • This reply was modified 1 year, 5 months ago by maxh_muc.
    #1413103

    Hi,


    @maxh_muc
    : We may need to access the site in order to investigate the issue further. Please open a new thread and post the login details in the private field. Did you update to version 5.6.3?

    Best regards,
    Ismael

    #1413205

    Thank you for the reply. I opened a new thread as requested. Here the link for follow-up: https://kriesi.at/support/topic/google-aanalytics-4-code-not-working/

    #1413272
Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘Google Analytics 4 – not working at all…’ is closed to new replies.