Google Tracking Id can be set for communities through Community Builder (advanced setting) however for communities that are on the 'Salesforce Tabs+ Visualforce' template community builder is not available.
How to set google analytics tracking no in this scenario. I guess it will need to be set directly through javascript into the visualforce page or is there any other better way.