Announcement

Collapse
No announcement yet.

Google Analytics input on vbulletin 5 forum

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

  • Google Analytics input on vbulletin 5 forum

    Been a while, where do I input this again? I don't see it in the vb5 Admin Control Panel.
    Last edited by MDawg; Sun 13th Aug '17, 3:55pm.

  • #2
    In AdminCP > Settings > Options. Then look for Google Analytics. Do not include the <script></script> tags when you paste the Analytics code.

    GIPHY for vB5 AutoLinker Auto-Create Flag Report Topic Social Icons in Postbit Clear Cache Cron DragDrop Upload Topic AJAX AutoUpdate Custom Avatars Selector Stop Links in Posts...and more!

    Comment


    • #3
      Found it, it is AdminCP > Settings > Options > Search Engine Tools

      They got rid of a separate "Google Analytics" pulldown menu at some point.

      Comment


      • Glenn Vergara
        Glenn Vergara commented
        Editing a comment
        Oh ok. Didn't know that.

    • #4
      This is broken now, because VB5 wraps the code with script tags, but Google is providing this:

      PHP Code:
      <!-- Global site tag (gtag.js) - Google Analytics -->
      <
      script async src="https://www.googletagmanager.com/gtag/js?id=***"></script>

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

        
      gtag('config''***');
      </
      script
      So to make it work you have to add a close script tag at the top, and an open script tag at the bottom.

      PHP Code:
      </script>
      [... 
      paste Google code in exactly as they ask you to ...]
      <
      script
      It would be ideal if vb5 didn't try to wrap the Google code at all and just let us paste exactly what Google asks us to -- which would only require removing those automatically generated script tags.

      Comment


      • #5
        I totally agree with you alfreema. But if they did that, all vB5 sites with GA will break and site owners must manually update their code. I think the acceptable solution now is to have a logic to check if script tags exist. If yes then don't include them, otherwise include them. Not an ideal solution but it avoids breakage for all existing sites.

        GIPHY for vB5 AutoLinker Auto-Create Flag Report Topic Social Icons in Postbit Clear Cache Cron DragDrop Upload Topic AJAX AutoUpdate Custom Avatars Selector Stop Links in Posts...and more!

        Comment


        • #6
          Originally posted by Glenn Vergara View Post
          I totally agree with you alfreema. But if they did that, all vB5 sites with GA will break and site owners must manually update their code. I think the acceptable solution now is to have a logic to check if script tags exist. If yes then don't include them, otherwise include them. Not an ideal solution but it avoids breakage for all existing sites.
          Yes, or automatically prepend and append the script tags into the user's existing GA code during the update (because 100% of existing users are expecting it to be there) and then stop automatically including them in code from that point on?

          Comment


          • Glenn Vergara
            Glenn Vergara commented
            Editing a comment
            That would work too. You have to file an improvement request in JIRA for it to be considered and implemented.

        • #7
          This is what I pasted in on my vb5

          (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','https://www.google-analytics.com/analytics.js','ga');

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

          This is correct and no need to change.

          Comment


          • #8
            Originally posted by alfreema View Post
            This is broken now, because VB5 wraps the code with script tags, but Google is providing this:

            PHP Code:
            <!-- Global site tag (gtag.js) - Google Analytics -->
            <
            script async src="https://www.googletagmanager.com/gtag/js?id=***"></script>

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

            gtag('config''***');
            </
            script
            So to make it work you have to add a close script tag at the top, and an open script tag at the bottom.

            PHP Code:
            </script>
            [... 
            paste Google code in exactly as they ask you to ...]
            <
            script
            It would be ideal if vb5 didn't try to wrap the Google code at all and just let us paste exactly what Google asks us to -- which would only require removing those automatically generated script tags.
            I am pretty sure this would be considered to be a potential exploit. I don't know why the script tags are added automatically but it would have to do with vBulletin Cloud. That is why Google Analytics was added at all.

            On the download version, you can avoid all this simply by creating a template that hooks into the footer.
            Translations provided by Google.

            Wayne Luke
            The Rabid Badger - a vBulletin Cloud customization and demonstration site.
            vBulletin 5 Documentation - Updated every Friday. Report issues here.
            vBulletin 5 API - Full / Mobile
            I am not currently available for vB Messenger Chats.

            Comment


            • #9
              Originally posted by Wayne Luke View Post

              I am pretty sure this would be considered to be a potential exploit. I don't know why the script tags are added automatically but it would have to do with vBulletin Cloud.
              But there are other places where you can add <script> tags such as in HTML modules, Ad modules, Announcements, Notices and Phrases. I don't understand why it would single out GA settings.

              GIPHY for vB5 AutoLinker Auto-Create Flag Report Topic Social Icons in Postbit Clear Cache Cron DragDrop Upload Topic AJAX AutoUpdate Custom Avatars Selector Stop Links in Posts...and more!

              Comment


              • #10
                Originally posted by Wayne Luke View Post

                I am pretty sure this would be considered to be a potential exploit. I don't know why the script tags are added automatically but it would have to do with vBulletin Cloud. That is why Google Analytics was added at all.

                On the download version, you can avoid all this simply by creating a template that hooks into the footer.
                The Google Analytics code itself has script tags in it, therefore the same injection that could be used sans automatic wrapping of script tags can be used with automatic wrapping of script tags (just locate them inside of Google's code instead of prepending it). It's simply use at your own risk functionality. So now the decision for VB is just a matter of convenience for your end users and minimizing support problems. It's inconvenient for the end user to autowrap the block with script tags, and will cause support issues.

                Don't get me wrong, I'm not complaining (because I know how to work around the problem). But I am not going to open a JIRA because I don't have time to learn how. I just wanted to point out it's "broken" based on how Google is currently dumping their javascript -- there's no way to remove script tags per the instructions, so I am just trying to help others out that have the same problem.
                Last edited by alfreema; Tue 17th Oct '17, 9:40am.

                Comment


                • Wayne Luke
                  Wayne Luke commented
                  Editing a comment
                  But I am not going to open a JIRA because I don't have time to learn how.
                  If you can post in this forum, you know everything you need to know about creating a bug report in the issue tracker.

              • #11
                Originally posted by alfreema View Post
                This is broken now, because VB5 wraps the code with script tags, but Google is providing this:

                PHP Code:
                <!-- Global site tag (gtag.js) - Google Analytics -->
                <
                script async src="https://www.googletagmanager.com/gtag/js?id=***"></script>

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

                gtag('config''***');
                </
                script
                So to make it work you have to add a close script tag at the top, and an open script tag at the bottom.

                PHP Code:
                </script>
                [... 
                paste Google code in exactly as they ask you to ...]
                <
                script
                It would be ideal if vb5 didn't try to wrap the Google code at all and just let us paste exactly what Google asks us to -- which would only require removing those automatically generated script tags.
                Thanks man! I didnt know what the hell was going on. VB page says one thing and goole another. I got it working with your solution.

                Comment


                • #12
                  The wrappers will not be needed in 5.4.0. http://tracker.vbulletin.com/browse/VBV-17799
                  Translations provided by Google.

                  Wayne Luke
                  The Rabid Badger - a vBulletin Cloud customization and demonstration site.
                  vBulletin 5 Documentation - Updated every Friday. Report issues here.
                  vBulletin 5 API - Full / Mobile
                  I am not currently available for vB Messenger Chats.

                  Comment


                  • #13
                    cool, good to know.

                    Comment

                    Related Topics

                    Collapse

                    Working...
                    X