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.
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..
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.
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.