title: How to include Google Analytics in Angular Cli application
body: <p>Usually including analytics was about pasting their tracking code in the html body, with the property Id and the pageview action. I followed the answer in
  <a href="https://stackoverflow.com/questions/37655898/tracking-google-analytics-page-views-in-angular2">Tracking Google Analytics Page Views in Angular2</a> and when doing <code>ng serve</code> it includes correctly the script but then when generating production aot it is not included in the index:</p>
  
  <pre><code>ng build --progress false --aot true -prod -e prod 
  </code></pre>
  
  <p>What is the best practice to include Google Analytics or other tracking solution with Angular2 Cli?</p>
  
  <p>Thanks in advance</p>