is there a way...

Discussion in 'HTML & Website Design' started by tytyguy, Jun 1, 2006.

Thread Status:
Not open for further replies.
  1. #1
    i have a website with about 500 pages. i just got google analytics and i dont know if i could paste the code on every single page. is there a way in dreamweaver to just put it on every page automatticly? i use dreamweaver 8. thanks a lot
     
    tytyguy, Jun 1, 2006 IP
  2. brian394

    brian394 Well-Known Member

    Messages:
    226
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Two suggestions...

    The first (and the one I would most recommend) would be to place your google analytics code in an include file. Include files are used to place common (or shared) code on multiple pages of your site. For example, your site's logo and navigation structure (which would remain the same on all pages of your site) can be placed in an include file and then simply referenced (or called) on all pages of your site. If you need to change your navigation structure later, you only need to change it in one spot (the include file) and then all pages which reference that include file will be updated as well. The syntax for using an include file largely depends on your webserver and what language you're writing your pages in.

    If you're writing in PHP for instance, you can use the include() function...

    There's also include_once(), require(), and require_once() which are similar but vary slightly in operation.

    Or, if your web server supports them, you can also use SSI (Server Side Includes) to include files (commonly used with ASP). The syntax is...

    <!-- #include virtual ="/includes/header.inc" -->

    If you do end up using SSI, make sure your pages end in .shtml though and not .html

    My second suggestion (if you do not want to use a server-side method) would be to use a Mass Find & Replace tool to search all 500 pages of your site. You can tell it to search for one common tag that appears on all pages of your site (for example '<head>'), and then to replace it with that tag plus your google analytics code. One such tool that can do this is called PowerGrep, but there are hundreds of others. Once you've decided on a Mass Find & Replace tool that you want to use, you can search for something like this:

    <HEAD>

    and replace it with something like this:

    <HEAD>
    <!-- Google Analytics code goes here -->

    Then you can tell it to effect (or process) all the files in a certain directory with a certain extention (for example, all .html files in C:\HTML)
     
    brian394, Jun 1, 2006 IP
  3. tytyguy

    tytyguy Peon

    Messages:
    406
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    nice thanks
     
    tytyguy, Jun 1, 2006 IP
  4. thelouisvilleseo

    thelouisvilleseo Peon

    Messages:
    112
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Brian - I want to work with you - contact me:
     
    thelouisvilleseo, Jun 1, 2006 IP
Thread Status:
Not open for further replies.