Announcement

Collapse
No announcement yet.

Adding Google Analytics Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wayne Luke
    replied
    Originally posted by Solid Signal View Post
    So using the script code at top as an example, what is the correct format for vB 5.4.0?

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

    Leave a comment:


  • Solid Signal
    replied
    So using the script code at top as an example, what is the correct format for vB 5.4.0?

    Leave a comment:


  • RUBE
    replied
    Originally posted by Wayne Luke View Post

    Yes. They will not be needed in 5.4.0. However, you code shouldn't break if they are left in.
    Thank You Sir for your quick response and...

    Thank You for Your Time!!!!!
    RUBE

    Leave a comment:


  • Wayne Luke
    replied
    Originally posted by RUBE View Post
    Hello


    I have vBulletin 5.3.3
    Do we still add those extra java script tags in there like that?

    Thank You for Your Time!!!!!
    RUBE
    Yes. They will not be needed in 5.4.0. However, you code shouldn't break if they are left in.

    Leave a comment:


  • RUBE
    replied
    Hello
    Wayne Luke Set "Enable Google Analytics" to Yes.
    Copy your code in the Google Analytics Javascript box. The closing (</script>) and opening script (<script>) tags that I posted are necessary in that order with the new code at this time.
    I have vBulletin 5.3.3
    Do we still add those extra java script tags in there like that?

    Thank You for Your Time!!!!!
    RUBE

    Leave a comment:


  • braintrainnerd
    replied
    Thanks a lot Wayne, it's working now.

    Leave a comment:


  • Wayne Luke
    commented on 's reply
    In the AdminCP go to Settings -> Options -> Search Engine Tools.

    Set "Enable Google Analytics" to Yes.
    Copy your code in the Google Analytics Javascript box. The closing (</script>) and opening script (<script>) tags that I posted are necessary in that order with the new code at this time.

    Those are the only two options that need to be changed for Analytics.

    Looking at the site, you switched the closing and opening tags that I added in my example above. This breaks the code. They need to be switched like I have them.

  • braintrainnerd
    commented on 's reply
    Should that be <script> at the top and </script> at the bottom?

    Also, in ACP > settings > options > Expand settings group, in the list there are 3 settings related to Analytics - "Google Analytics Account ID", "Enable Google Analytics" and "Google Analytics Javascript". I entered your suggested code into the "Enable Google Analytics" settings, but it doesn't appear to be working - analytics doesn't show anybody visiting my forum, even though I am browsing it. Should I be editing any of the other 2 settings on the list?

  • Wayne Luke
    commented on 's reply
    vBulletin Cloud doesn't have access to Template Hooks or to edit Templates directly.

  • Wayne Luke
    replied
    We're working to update the software to handle the new format. Currently, you have to add it like this:

    Code:
    </script>
    <!-- Global Site Tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-1"></script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments)};
    gtag('js', new Date());
    
    gtag('config', 'UA-XXXXXXXXX-1');
    </script>
    <script>
    I am sorry for the confusion.

    Leave a comment:


  • braintrainnerd
    replied
    Thanks for your reply William. I will try your suggestions later and report back if I have any problems.

    Leave a comment:


  • William Thomas Jr
    replied


    I would think you could create a new template if you can't find a solution.

    1) Create a new template called footer_google_analytics.

    2) Paste your Google code into it. Save the template.

    3) Go to Products and Hooks in the Admin CP. Click "Add New Hook".

    4) Select "footer_copyright" as the Hook Location.

    5) Give it the title, Google Analytics

    6) For the template name enter footer_google_analytics

    7) Save the hook.

    Other wise, wouldn't putting the code in the footer template before </body> tag work? Or put the code in header include.
    Last edited by William Thomas Jr; Sun 22nd Oct '17, 4:47pm.

    Leave a comment:


  • braintrainnerd
    replied
    I am in the exact same situation. The current google analytics code is different from the old code.

    Leave a comment:


  • bowiedawgs01
    started a topic Adding Google Analytics Question

    Adding Google Analytics Question

    A previous admin had tried to setup Analytics in the past, and the code was still in there. I created my own Analytics account and want to install it myself. I have a couple of questions.

    I have read people say to remove the <script> tags. Can you be more specific?

    Here's the code Google gives me:

    <!-- Global Site Tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-1"></script>

    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments)};
    gtag('js', new Date());

    gtag('config', 'UA-XXXXXXXXX-1');
    </script>

    Do I remove everything in bold? The line with the link to googletagmanager confuses me. How do I remove the <script> tags from that? How should it look if I'm not removing it completely?

    Question 2: The old code that was in there, as well as an example posted on this site with a similar question earlier this year, is completely different than the one Google is giving me. It looks like this:

    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-XXXXXXXXX-1', 'auto');
    ga('send', 'pageview');

    Which one is right? I don't see that old code anywhere. Did Google change it up?

Related Topics

Collapse

Working...
X