Google Analytics and PHP - bad combination?

Discussion in 'PHP' started by cavemanlawyer15, Aug 11, 2007.

  1. #1
    My site is http://www.laviolarestaurant.com - I'm new to PHP and pulling my hair out trying to get this Analytics code in there. (I'm pretty sure this is a Static PHP site, it barely ever gets updated.)

    So the Help Center offered what looked like a pretty good start on how to set this up for PHP:
    http://www.google.com/support/googleanalytics/bin/answer.py?answer=55504&query=php&topic=&type=

    1) I created the analyticstracking.php file (updated the account # of course) and just to be safe, I uploaded to both
    /public_html AND /public_html/php

    2) Next -- I couldn't find anything that looked like a footer, so I had to add this line to every template page:
    <?php include_once("analyticstracking.php") ?>

    And the directions say to add it before the </body> tag. But that's the problem; as far as I can tell, these are the template pages:

    /public_html/php/mainSubPage.php
    /public_html/php/newsletterSignup.php
    /public_html/php/sendGiftCertificate.php
    /public_html/php/showCalendar.php
    /public_html/php/showDynamicContents.php
    /public_html/php/showFeedbackForm.php
    /public_html/php/showGuestBook.php
    /public_html/php/showMenu.php
    /public_html/php/showOrderForm.php
    /public_html/php/showPhotos.php
    /public_html/php/showPicture.php
    /public_html/php/showPictureFrame.php
    /public_html/php/showPictureTop.php

    3) And here I find two problems.

    a) These files don't seem to have </body> tags. Am I wrong in assuming that these are in fact the template files?

    b) I backed these up and renamed the originals -- and the site was still reading them!!! In other words, those with the original filenames were sitting on my hard drive, and the backed up versions had new names that the PHP file ought not to be able to read. But it could!?!?! What gives?


    I'm dying here. If anyone knows anything about this, I'd be forever in your debt.

    PB
     
    cavemanlawyer15, Aug 11, 2007 IP
  2. ecentricNick

    ecentricNick Peon

    Messages:
    351
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well, I visited your site, did a "view source" and saw this at the bottom...

    
    
        <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
      _uacct="UA-2369453-1";
      urchinTracker();
    </script>
    
    Code (markup):
    So, I think you must have solved it?
     
    ecentricNick, Aug 11, 2007 IP
  3. coderlinks

    coderlinks Peon

    Messages:
    282
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I see its working now. Nice template BTW :D.

    ~
    Thomas
     
    coderlinks, Aug 12, 2007 IP