How do I insert analytics into my PHP code

Discussion in 'PHP' started by imgtube, Dec 17, 2006.

  1. #1
    This is the analytics code and needs to be inserted immediately before </body>:

    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-998977-1";
    urchinTracker();
    </script>

    And I need to insert it into:

    <?
    include "inc/config.php";
    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html><head><title><? echo $page; ?></title>
    <link rel="stylesheet" href="inc/style.css" type="text/css">
    <?
    include "inc/head.php";
    ?>
    <td align="left" valign="bottom">
    <b> </b></td>
    </tr></tbody></table>
    <table class="table_decoration" align="center" border="1" bordercolor="#ffffff" cellpadding="5" width="675"><tbody><tr><td valign="top">
    <script type="text/javascript"><!--
    google_ad_client = "pub-5600484316135690";
    google_ad_width = 300;
    google_ad_height = 250;
    google_ad_format = "300x250_as";
    google_ad_type = "text_image";
    //2006-11-22: imgtube
    google_ad_channel = "9703304956";
    google_color_border = "f6f6f6";
    google_color_bg = "f6f6f6";
    google_color_link = "F2984C";
    google_color_text = "CCCCCC";
    google_color_url = "808080";
    //2006-12-15: Image Tube
    google_ad_channel = "9092466005";
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </td><td valign="top"><p><center><Br/><br/><? echo $site; ?> Strives to Make Image Uploading Easy.</p><p>Read the <a href="<? echo $domain; ?>/tos.php"><b>Terms of Service</b></a> Before Uploading Anything<br>
    <form enctype="multipart/form-data" action="final.php" id="form" method="post" onSubmit="a=document.getElementById('form').style;a.display='none';b=document.getElementById('part2').style;b.display='inline';" style="display: inline;">
    <div align="center"> <br>
    <b>Upload</b>:
    <INPUT NAME="userfile" TYPE="file" class="asd" size="27">
    <br>
    <br>
    <input name="upload" type="submit" class="asd" value="tube it!">
    &nbsp;
    </p>
    </div></form>
    <p>
    <input name="MAX_FILE_SIZE" value="3145728" type="hidden">
    <input name="refer" value="" type="hidden">
    <input name="brand" value="" type="hidden">
    </p>
    <div id="filetypeerror" style="display: none;"> <b style="color: red;">Please select only one of the supported file types:</b><br></div>
    </form><br/><div id="part2" style="display: none;">
    <center><script language="javascript" src="xp_progress.js"></script>
    Upload in progress. Please Wait...
    <BR><BR>
    <script type="text/javascript">
    var bar1= createBar(300,15,'white',1,'black','orange',85,7,3,"");
    </script></center>
    </div>
    <p>allowed: <b>jpg jpeg png gif bmp tif tiff swf</b><br/> max size: <? print("$max_size_mb"); ?>MB</p></center>
    </td>
    </tr></tbody></table>
    <div class="links" align="center">
    <?
    include "inc/foot.php";
    ?>
    </div>
    </td></tr></tbody></table> <br>
    </div>
    </div>
    </div>
    </body></html>

     
    imgtube, Dec 17, 2006 IP
  2. abuzant

    abuzant Well-Known Member

    Messages:
    956
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    140
    #2
    What's the problem then?

    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html><head><title><? echo $page; ?></title>
    <link rel="stylesheet" href="inc/style.css" type="text/css">
    <?
    include "inc/head.php";
    ?>
    <td align="left" valign="bottom">
    <b> </b></td>
    </tr></tbody></table>
    <table class="table_decoration" align="center" border="1" bordercolor="#ffffff" cellpadding="5" width="675"><tbody><tr><td valign="top">
    <script type="text/javascript"><!--
    google_ad_client = "pub-5600484316135690";
    google_ad_width = 300;
    google_ad_height = 250;
    google_ad_format = "300x250_as";
    google_ad_type = "text_image";
    //2006-11-22: imgtube
    google_ad_channel = "9703304956";
    google_color_border = "f6f6f6";
    google_color_bg = "f6f6f6";
    google_color_link = "F2984C";
    google_color_text = "CCCCCC";
    google_color_url = "808080";
    //2006-12-15: Image Tube
    google_ad_channel = "9092466005";
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </td><td valign="top"><p><center><Br/><br/><? echo $site; ?> Strives to Make Image Uploading Easy.</p><p>Read the <a href="<? echo $domain; ?>/tos.php"><b>Terms of Service</b></a> Before Uploading Anything<br>
    <form enctype="multipart/form-data" action="final.php" id="form" method="post" onSubmit="a=document.getElementById('form').style;a.display='none';b=document.getElementById('part2').style;b.display='inline';" style="display: inline;">
    <div align="center"> <br>
    <b>Upload</b>:
    <INPUT NAME="userfile" TYPE="file" class="asd" size="27">
    <br>
    <br>
    <input name="upload" type="submit" class="asd" value="tube it!">
    &nbsp;
    </p>
    </div></form>
    <p>
    <input name="MAX_FILE_SIZE" value="3145728" type="hidden">
    <input name="refer" value="" type="hidden">
    <input name="brand" value="" type="hidden">
    </p>
    <div id="filetypeerror" style="display: none;"> <b style="color: red;">Please select only one of the supported file types:</b><br></div>
    </form><br/><div id="part2" style="display: none;">
    <center><script language="javascript" src="xp_progress.js"></script>
    Upload in progress. Please Wait...
    <BR><BR>
    <script type="text/javascript">
    var bar1= createBar(300,15,'white',1,'black','orange',85,7,3,"");
    </script></center>
    </div>
    <p>allowed: <b>jpg jpeg png gif bmp tif tiff swf</b><br/> max size: <? print("$max_size_mb"); ?>MB</p></center>
    </td>
    </tr></tbody></table>
    <div class="links" align="center">
    <?
    include "inc/foot.php";
    ?>
    </div>
    </td></tr></tbody></table> <br>
    </div>
    </div>
    </div>
    
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-998977-1";
    urchinTracker();
    </script>
    
    </body></html>
    
    Code (markup):
     
    abuzant, Dec 17, 2006 IP
  3. imgtube

    imgtube Well-Known Member

    Messages:
    562
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #3
    It worked then, last time I tryed it it screwed up all my pages.
     
    imgtube, Dec 17, 2006 IP
  4. coolmaste

    coolmaste Peon

    Messages:
    120
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i think you pasted it some where else
     
    coolmaste, Dec 18, 2006 IP
  5. ico

    ico Peon

    Messages:
    126
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    put it inside the <head>code</head> or after the metas
     
    ico, Dec 19, 2006 IP
  6. mani

    mani Peon

    Messages:
    679
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #6
    insert it just before the end of </body> tag, i did the same and it still works fine for me
     
    mani, Dec 20, 2006 IP
  7. pixel_perfect

    pixel_perfect Banned

    Messages:
    238
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    dont add in head tag paste just before body tagclosing and it does'nt mess the pages as there is nothing to show in this.
     
    pixel_perfect, Dec 20, 2006 IP