We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37550 ☆ A M B ☆
    • 711 Posts
    Hi

    Ive recently been finding when working on a MODx site and testing it out my Analytics stats go off the scale due to manager users testing out the site etc so i thought it would be a good idea to be able to disable Analytics code if you was logged into the MODx Manager.

    So heres the instructions

    1. In your template or footer chunk add in a snippet call to [[googleAnalyticsCode]]

    2. Create a chunk called googleAnalyticsCode and paste in your google tracking code

    3. Create a snippet called googleAnalyticsCode and paste in the following


    <?php
    $google_AnalyticsCode = "";

    if(!isset($_SESSION[’mgrValidated’])) {
      // Pull in Analytics Code
      $google_AnalyticsCode = $modx->putChunk(’googleAnalyticsCode’);
    } 

    return $google_AnalyticsCode;
    ?>


    Hope this is helpful for you all

    Aaron
      http://www.onesmarthost.co.uk
      UK MODX Hosting with love.
      • 16610
      • 634 Posts
      Great! Thank you very much for sharing!
        Mikko Lammi, Owner at Maagit
        • 25663 MODX Staff
        • 12,272 Posts
        I believe that the Google Analytics plugin in the repository already does this and also respects the log hits checkbox for pages as well.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 37550 ☆ A M B ☆
          • 711 Posts
          Quote from: rthrash at May 12, 2009, 06:48 AM

          I believe that the Google Analytics plugin in the repository already does this and also respects the log hits checkbox for pages as well.

          Doh!

          I always have a job searching the new resources page I guess this is the link: http://modxcms.com/extras.html?view=package/view&package=180 is it broke?

          Aaron
            http://www.onesmarthost.co.uk
            UK MODX Hosting with love.
            • 25663 MODX Staff
            • 12,272 Posts
            Was thinking of this one: http://modxcms.com/extras.html?view=package/view&package=178

              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 37550 ☆ A M B ☆
              • 711 Posts
              Will check that out thanks,

              There seems to be some type of style error on the resources page all I see is

              Latest Release Previous Releases Comments

              then the green footer and if I scroll down the description is below, let me know if you cant see the glitch your end and I can post a screenshot.

              Im using IE7 runs fine in Firefox.

              Aaron
                http://www.onesmarthost.co.uk
                UK MODX Hosting with love.