1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to Insert Google Analytics in every html page?

Discussion in 'Google' started by ewolf, Jan 13, 2009.

  1. #1
    Hi, I have to insert Google Analytic Tracking Code to MoU MyOpenUniversity.com , the web hosting supports PHP, so is there any PHP code by using which i can automatically insert the Google Analytic Tracking Code into every HTML page?

    cheers
     
    ewolf, Jan 13, 2009 IP
  2. zbreeze

    zbreeze Peon

    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    zbreeze, Jan 13, 2009 IP
  3. M3rC

    M3rC Peon

    Messages:
    1,493
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah, that guide explains everything.

    You can always have a separate "footer.htm" or "footer.php" and insert the code into just that.
    Saves you the time from having to insert it into every single page :)
     
    M3rC, Jan 13, 2009 IP
  4. Rasputin

    Rasputin Peon

    Messages:
    1,511
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Rasputin, Jan 14, 2009 IP
  5. ewolf

    ewolf Peon

    Messages:
    111
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you for the reply, the reason i mentioned the PHP thing cuz someone told me that it can be done using Server Side Include but then they mentioned for that i have to rename all the pages from HTML to SHTML which would be pretty tedious process so i didn't go with that one.

    My website is a static one rather than dynamic. All the pages were created and then uploaded to the server so i think the info on the link dose not imply on the pages of the website.
     
    ewolf, Jan 14, 2009 IP
  6. ewolf

    ewolf Peon

    Messages:
    111
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6

    I have searched my Directory where my files are at, there is no such file like called htaccess in any of the Dirs.

    P.S:-
    I was looking for the htaccess file in my File Manager, am i looking for it in the the place? Sorry i don't know much about Web Developing.
     
    ewolf, Jan 14, 2009 IP
  7. lilporkchop

    lilporkchop Peon

    Messages:
    44
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    is it a static website or a dynamic CMS?
     
    lilporkchop, Jan 14, 2009 IP
  8. Rasputin

    Rasputin Peon

    Messages:
    1,511
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #8
    If there is an .htaccess file already you should see it in your file manager

    If there isn't, you need to create one - search on 'create an htaccess file' for information - it's straightforward but needs to be exactly right. Check your site as soon as you've added it, to check all is well.

    edit: you'll then need to do a bit of research on php 'include' and 'require' functions. Time spent on this will be time extremely well spent - no more sitewide 'find and replace' when you want to change the heder, footer, adsense ads etc
     
    Rasputin, Jan 14, 2009 IP
  9. ewolf

    ewolf Peon

    Messages:
    111
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    static, pages were created offline and were uploaded later on.
     
    ewolf, Jan 14, 2009 IP
  10. ewolf

    ewolf Peon

    Messages:
    111
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10

    ok, i will give it a go thanks.
     
    ewolf, Jan 14, 2009 IP
  11. ewolf

    ewolf Peon

    Messages:
    111
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    isn't there any simpler way?
     
    ewolf, Jan 14, 2009 IP
  12. davejuk

    davejuk Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    If you have more than a dozen pages then you should be using some kind of CMS, custom or bought/downloaded as a package. In PHP you can use templates for content common to all pages, in which you would insert the tracking code. On a Windows server running ASP.NET you want Master Pages.

    As a short-term fix you could just do a quick search and replace. Open all your documents in a text editor such as EditPad Pro (free trial that doesn't expire) and do a search and replace on "</body>" replacing it with:

    "</body>

    Tracking
    code
    here"

    You could move to using PHP templates using this same technique. Equally, I'm sure there are loads of free little applications out there which will let you change the file extension for a large number of files in one go.
     
    davejuk, Jan 14, 2009 IP
  13. JosephineX

    JosephineX Peon

    Messages:
    49
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Perform a find and replace operation on the source, its the only other way.
     
    JosephineX, Jan 14, 2009 IP
  14. IEmailer.com

    IEmailer.com Well-Known Member

    Messages:
    1,864
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    110
    #14
    no matter if it's static html files or PHP based you still need to add even the include line if used PHP or simply add the tracking code provided by analytics instep to track every single page.

    So, sorry to say that but there is no easy way to do it ;)
     
    IEmailer.com, Jan 14, 2009 IP
  15. opmax-thailand

    opmax-thailand Peon

    Messages:
    228
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #15
    create a footer in php and include it everywhere
     
    opmax-thailand, Jan 14, 2009 IP
  16. Chancey

    Chancey Well-Known Member

    Messages:
    3,933
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    130
    #16
    I think that this belongs to the programming section.
     
    Chancey, Jan 15, 2009 IP