Announcement

Collapse
No announcement yet.

use Google Tag Manager instead of Analytics

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

  • use Google Tag Manager instead of Analytics

    My company uses Google Tag Manager to control a number of sites. I am wondering if it might be possible to use my Google Tag Manager account instead of just Analytics.

    The tag format is slightly different. The instructions say:

    Paste this code as high in the <head> of the page as possible:
    Code:
    <!-- Google Tag Manager -->
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','XXX-XXXXXX');</script>
    <!-- End Google Tag Manager -->
    I could replace the Analytics code with the above, but then it also asks for:
    Additionally, paste this code immediately after the opening <body> tag:
    Code:
    <!-- Google Tag Manager (noscript) -->
    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=XXX-XXXXXX"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <!-- End Google Tag Manager (noscript) -->
    Where XXX-XXXXXX is the GTM account number.

    Is this possible?

  • #2
    On your site click Header in the Site Builder menu. Place the second code snippet in the first header ad location at the top of the screen. That will get you as close to the <body> tag as possible.

    The second code probably isn't 100% necessary. It is only for browsers that have JavaScript turned off. vBulletin will not work in such a browser and the user will need to enable Javascript.
    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


    • #3
      Is there any way to insert code in between the
      Code:
      <head></head>
      tags?

      I mistakenly thought that vB placed Analytics code in the <head>, but it seems that it is placed closer to </body>
      Since about 2014 or so, Google has instructed this code be placed in the <head>. This is particularly specified with the newer global site tags.

      I know that the older Analytics tags could be placed almost anywhere in the page, and the bottom of the page is where the code used to reside.

      Is this the relevant issue in the tracker? https://tracker.vbulletin.com/vbulle...sues/VBV-17695 or would it be worthwhile to open a new issue to request that the Analytics code be placed in the <head>?

      Comment


      • #4
        On cloud you can place the code in the Google Verification box under Settings -> Options -> Search Engine Tools.
        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

        Related Topics

        Collapse

        Working...
        X