Google Analytics - Install Issues, Advanced Usage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • David Dilbert
    New Member
    • Aug 2007
    • 14

    Google Analytics - Install Issues, Advanced Usage

    Just going through some of the threads trying to find out how to install Google Analytics into our own vBulletin installation, I noticed a lot of people really concerned about where the code goes, and were quite paranoid that they couldn't find a </body> tag, like google suggests.

    So I wanted to clear a couple of things up.

    First of all Analytics doesn't NEED to go before the end of the body tag, its suggested to go there, for a couple of reasons, first of all, Google knows that because some people don't have the fastest connections, or aren't close to a google connection, the load time may be slow. So placing the code near the END of the page, ensures everything else on your page loads first.

    So the code would go near the bottom of the footer template (STYLE MANAGER/EDIT TEMPLATES) like so:
    HTML Code:
    ...PREVIOUS FOOTER CODE...
    <!-- / auto DST correction code -->
    </if>
    <script type="text/javascript">
    <!--
        // Main vBulletin Javascript Initialization
        vBulletin_init();
    //-->
    </script>
    
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-XXXXXXX-X";
    urchinTracker();
    </script>
    Second, no one can abuse or USE any of the advanced functionality that the urchin Javascript file includes.
    For instance, all of our sites, use the Analytics code, just after the body tag starts (in vBulletin users case, that would be at the top of the header, in the header template) Why?
    Because now we can use advanced functionality, we can track any clicks, images, mouse movements, clicks, form submissions, page leaves, anything. Just by adding some code to whatever we want to track.

    For instance:
    If I put the code in the header like so:
    HTML Code:
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-XXXXXXX-X";
    urchinTracker();
    </script>
    <!-- logo -->
    <a name="top"></a>
    <table border="0" width="$stylevar[outertablewidth]" cellpadding="0" cellspacing="0" align="center">
    <tr>
        <td align="$stylevar[left]"><a href="$vboptions[forumhome].php$session[sessionurl_q]"><img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" /></a></td>
        <td align="$stylevar[right]">
    ...REST OF HEADER CODE...
    I can now track anything I want.
    So I have a link that goes back to my main site/home page, and I want to know who/how many times/what keywords they came in from, etc.. everytime they click on that link.

    So my footer code has the link in it:
    HTML Code:
    <a href="http://www.analyticssupport.com"  accesskey="9">AnalyticsSupport.com Home</a>
    To add tracking everytime someone clicks on it I do the following:

    HTML Code:
    <a href="http://www.analyticssupport.com"  accesskey="9" onclick="javascript:urchinTracker('clicked on home'); return true;">AnalyticsSupport.com Home</a>
    I can put anything I want in those brackets. 'clicked on home', 'went to analytics support.com' 'externalclick/analyticssupport.com'
    And it will show up in analytics just the way I've written it.


    Also, I can track anything, by just changing the onclick= to whatever I'm wanting to track. For <FORM tags, I use onsubmit= for images <IMG, I could use onmouseover= to track when someone actually sees and passes over an img, etc...

    If you are looking to do this, and notice your page taking a long time to load, you can download the urchin.js file, and place it locally on your server. However, if you do this, you MUST update it at least once a week, for safety and accuracy's sake.

    Hope this clears things up.

    David...
    google.AnalyticsSupport.com
    google.AnalyticsSupport.com/blog
    google.AnalyticsSupport.com/forums
    Last edited by David Dilbert; Sat 11 Aug '07, 10:06am.
  • Flight_Teacher
    New Member
    • May 2007
    • 9
    • 3.6.x

    #2
    Here is my question.

    Analytics can't seem to verify that the code has been added (which it has)

    I think the problem has to do with the fact that I use a redirect to the forums folder. The redirect is just a meta tag on the index.html file in the root folder.

    So, how can I change the default forum installation so that the index is in my root folder? or is there another redirect that will work?

    Comment

    • David Dilbert
      New Member
      • Aug 2007
      • 14

      #3
      I'm not quite sure what you are doing, but from what you've said, it looks as though your putting your analytics code in the index.html that is redirecting via meta redirect.

      Remember, analytics code is placed in the body, and NEEDS to be fully loaded.
      So how could that happen, if your meta redirect WHICH HAPPENS IN THE HEAD, which means the page isn't even loaded yet, how can it load all of the analytics code then? It can't.

      If this isn't the problem, then I think you need to describe it a little better, and include some code.

      David...
      google.AnalyticsSupport.com
      google.AnalyticsSupport.com/blog
      google.AnalyticsSupport.com/forums

      Comment

      • aacircle
        Member
        • Jun 2005
        • 70
        • 3.6.x

        #4
        Yeh, I can't get Google Analytics working either on my site. Have placed the Analytics script at the very end of my footer template, yet the code can't be verified still by Google.

        Is there something else I need to do?

        Thank you.

        Comment

        • David Dilbert
          New Member
          • Aug 2007
          • 14

          #5
          Did you check your Analytics Code to see if it came before or After your Adsense code?

          Also, I recommend using a tool such as Firebug for Firefox, which will show you all external Javascript (script files) and if they were loaded or not.

          From what I can see, using Firebug. Your Urchin.js file is loading perfectly from Googles remote server.
          So it should be working.

          Something might be preventing the script from making a call back to the google servers, thats why I suggest putting your code in the very beginning of the page, before anything else.

          Comment

          Related Topics

          Collapse

          Working...
          😀
          😂
          🥰
          😘
          🤢
          😎
          😞
          😡
          👍
          👎