We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33337
    • 3,975 Posts
    Snippet name: GoogleAnalytics

    Author: Written by Raymond Irving - 16 Jan, 2006

    Description: Adds the Google’s urchin tracker to a web page.

    Usage:
    [[GoogleAnalytics?account=`UA-000000-0`]]


    Please download attached file.

    Best regards,

    zi
      Zaigham R - MODX Professional | Skype | Email | Twitter

      Digging the interwebs for #MODX gems and bringing it to you. modx.link
      • 6726
      • 7,075 Posts
      This will come handy, thanks Raymond laugh !
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 4095
        • 372 Posts
        Cool, was going to attempt write one once I got an Analytic account. As always you’re all one (many) steps ahead of me.

        Thanks grin
          [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
          Admin Sandbox Login: sandbox Password: castle
          • 25663 MODX Staff
          • 12,272 Posts
          Few quick questions re: the snippet:
          Should the call be to regClientStartupScript as follows?
          Is there any reason not to include the two regClientStartupScript calls into one?
          Is it missing a semi-colon at the end of the closing bracket?

          Possible rev:
          /*
           * 	Name:	GoogleAnalytics
           *	Author:	Written by Raymond Irving - 16 Jan, 2006
           *	Desc:	Adds the Google's urchin tracker to a web page.
           *
           *	Usage:	[[GoogleAnalytics?account=`UA-000000-0`]]
           */
          
          $account = isset($account)? $account: '';
          
          if(!empty($account)) {
          	$modx->regClientStartupScript('
              <script type="text/javascript" src="http://www.google-analytics.com/urchin.js"></script>
              <script type="text/javascript">
                  // Google Site tracking
                  _uacct = "'.$account.'";
                  urchinTracker();
              </script>
              ');
          }
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 30277
            • 75 Posts
            Right after i add snippet , when my manager refreshes i get a system alert window says

            An error occurred while loading. Please see the event log for more information

            Parse error: syntax error, unexpected ’}’ in /home/..../public_html/manager/includes/document.parser.class.inc.php(750) : eval()’d code on line 21
            i have this at line 750
            $snip= eval ($snippet);


            after close the window i see new snippet there but i got same error on my page also .Iam using rc3
              • 27330
              • 884 Posts
              I’m also getting pharse errors.
              I tried Ryan version and getting same error. is there an updated version for this or any idea how to solve this?

              Parse error: syntax error, unexpected '/' in /home/smart60/public_html/manager/includes/document.parser.class.inc.php(748) : eval()'d code on line 2
                • 19164
                • 1,215 Posts
                Try to add <?php in first line and ?> after the last.
                  DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

                  Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

                  [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
                  • 27330
                  • 884 Posts
                  It’s there already sad

                  <?php
                  / * 	Name:	GoogleAnalytics
                   *	Author:	Written by Raymond Irving - 16 Jan, 2006
                   *	Desc:	Adds the Google's urchin tracker to a web page.
                   *
                   *	Usage:	[[GoogleAnalytics?account=`UA-1834246`]]
                   */
                  
                  $account = isset($account)? $account: '';
                  
                  if(!empty($account)) {
                  	$modx->regClientStartupScript('
                      <script type="text/javascript" src="http://www.google-analytics.com/urchin.js"></script>
                      <script type="text/javascript">
                          // Google Site tracking
                          _uacct = "'.$account.'";
                          urchinTracker();
                      </script>
                      ');
                  }
                  ?>
                    • 33372
                    • 1,611 Posts
                    Dunno why, but you have a space between the slash and dot on line two:

                    / * 	Name:	GoogleAnalytics


                    Get rid of that space so that the text that is supposed to be commented out is not executed (or just delete the whole comment if you prefer).
                      "Things are not what they appear to be; nor are they otherwise." - Buddha

                      "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                      Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                      • 27330
                      • 884 Posts
                      ohhh man that’s emberassing smiley don’t know what I smoked.
                      thx Zap!