How do I add Google Analytics code to multiple pages?

Discussion in 'Google Analytics' started by avin7000, Jul 8, 2013.

  1. #1
    I have thousands of pages to them I want to add Google Analytics code. I have searched for solutions online, but nothing seem concrete.

    I have figured out following two ways :
    1. add code to each page manually using some GUI editor.
    2. Write a python script, which runs on my server recursively, finds all .html pages, takes them as input, finds & places the code line above it.

    I have some PHP files too, so I will create an analytics.php & include it in every php file (almost same as above process).

    Are there any better methods ?

    Currently I am adding code manually, will write a script soon & try with that.
     
    avin7000, Jul 8, 2013 IP
  2. prabha123

    prabha123 Greenhorn

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #2
    You Can develop Head.html page put the google analytics code in head.html and call the head.html in your every html page. so u do not adding code manually..
     
    prabha123, Jul 8, 2013 IP
  3. avin7000

    avin7000 Greenhorn

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    Yes, but its just same as adding code to every page.
     
    avin7000, Jul 8, 2013 IP
  4. prabha123

    prabha123 Greenhorn

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #4
    No You have to Develop Head.html file and you have call head.html in everypage. in this way u have to save your much time compare adding code in everypage.
     
    prabha123, Jul 8, 2013 IP
  5. OSSEO

    OSSEO Active Member

    Messages:
    1,430
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    53
    #5
    You need to add code on any include file like header or footer, if you did not made file then make it and ad code there.
     
    OSSEO, Jul 9, 2013 IP