google-analyticsstatistics

Adding google analytics code to all pages


I want to add google analytics code to all pages in my website. Can I place google analytics code in a JS file and mention the JS file in the header?


Solution

  • in simple html pages there is no standard way to render script on each page , you can put ur GA code into separate .js file , and then include it on each Html page in header like

    <head>
       <script src="#path-to-Code-with-GA" type="text/javascript" />
    </head>
    

    That's the only solution i can suggest :-(