Google Analytics code... where does it go?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sunkapoor22
    New Member
    • Nov 2009
    • 18

    [CMS] Google Analytics code... where does it go?

    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
    try {
    var pageTracker = _gat._getTracker("UA-12059730-4");
    pageTracker._trackPageview();
    } catch(err) {}</script>

    I added the above code to the VERY END in the footer template, and I get the following error by vbulletin when I save the file:

    The following error occurred when attempting to evaluate this template:

    Parse error: syntax error, unexpected '[' in /home6/intraspa/public_html/includes/adminfunctions_template.php(4597) : eval()'d code on line 131

    This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.
    If I ignore the error and continue, the web site doesn't look pretty at all. Please advice.

    Thanks!
  • Lynne
    Former vBulletin Support
    • Oct 2004
    • 26255

    #2
    You need to add <vb:literal> at the beginning and </vb:literal> at the end.

    Please don't PM or VM me for support - I only help out in the threads.
    vBulletin Manual & vBulletin 4.0 Code Documentation (API)
    Want help modifying your vbulletin forum? Head on over to vbulletin.org
    If I post CSS and you don't know where it goes, throw it into the additional.css template.

    W3Schools &lt;- awesome site for html/css help

    Comment

    • Plus
      New Member
      • Aug 2009
      • 10

      #3

      Comment

      • azbryanw
        Member
        • Dec 2009
        • 49
        • 4.0.0

        #4
        this fixed it for me!
        My Forum: http://www.financialplanningexchange.com

        The first virtual peer to peer study group for financial planners and the financial planning community.

        Comment

        • sunkapoor22
          New Member
          • Nov 2009
          • 18

          #5
          sweet!

          Comment

          • tunerclub.net
            New Member
            • Jan 2010
            • 5
            • 4.0.0

            #6
            badass!, thanks!
            Last edited by tunerclub.net; Mon 1 Mar '10, 3:22am.

            Comment

            • sportsfroma2
              Member
              • May 2010
              • 35

              #7
              stupid question: just to make sure, the footer template will capture traffic from all the CMS and forum pages, right? I figured it was fine for the Forum just wasn't totally sure if the CMS used the same footer template.

              thanks

              Comment

              • Lynne
                Former vBulletin Support
                • Oct 2004
                • 26255

                #8
                The footer is on all pages. You may select to use different styles in the CMS or Blog or Forums, so make sure you put the code in the footer template of the styles you are using.

                Please don't PM or VM me for support - I only help out in the threads.
                vBulletin Manual & vBulletin 4.0 Code Documentation (API)
                Want help modifying your vbulletin forum? Head on over to vbulletin.org
                If I post CSS and you don't know where it goes, throw it into the additional.css template.

                W3Schools &lt;- awesome site for html/css help

                Comment

                • Rik Brown
                  Senior Member
                  • May 2005
                  • 345
                  • 4.2.X

                  #9
                  There is a nifty mod at vbulletin.org that allows you to easily add the Google Analytics code to your pages without all of the fuss. -- Rik

                  Comment

                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                  Working...