Google Analytics code

Home Forums WordPress Theme Support BfastMag Pro Google Analytics code

This topic contains 2 replies, has 2 voices, and was last updated by  leegvincent 6 years, 4 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8965

    leegvincent
    Member

    Hi

    I cant get the theme to talk to google

    the code google tacking gives is in the format:

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

    how do i edit this to enter into the theme? which script tags need removing ?

    #8969

    Raja CRN
    Keymaster

    Hello,

    We’ve provided the inline scripts text area. But you have added the external scripts with script tag. Use this code in text area.

    var s = document.createElement("script");
    s.type = "text/javascript";
    s.src = "https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID";(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(s);
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments)};
    gtag('js', new Date());
    gtag('config', 'GA_TRACKING_ID');
    #8970

    leegvincent
    Member

    Thanks very much 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

Only Verified Customer of this Theme Can post reply to this Support Topic! .