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

    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


    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=""></script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', 'G-XXXXXXXXXX');

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



    yup, it would seem that as of Enfold version, does not support the new Google Analytics 4.
    it is possible to create the old “Universal” Google Analytics still…

    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.



    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
    add_action('wp_head', 'new_analytics_code');

    Best regards,


    functions.php in wp-includes or in Enfold?



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

    Best regards,


    So all this?

    function new_analytics_code(){
    <!– Global site tag (gtag.js) – Google Analytics –>
    <script async src=””></script&gt;
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag(‘js’, new Date());

    gtag(‘config’, ‘G-XXXXXXXXXX’);
    add_action(‘wp_head’, ‘new_analytics_code’);


    Works a treat – thank you!

    • This reply was modified 2 years, 6 months ago by whdsolutions.

    Hi whdsolutions,

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

    Best regards,


    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!


    Hi BruceJackson,

    This should work as expected in the latest version of the theme, could you try updating to that please?

    Best regards,

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