title: Ember CLI and Google Analytics
body: <p>According to the <a href="https://guides.emberjs.com/v1.10.0/cookbook/helpers_and_components/adding_google_analytics_tracking/" rel="nofollow noreferrer">docs</a>, you just need to embed the analytics code and reopen the Router.  The latter seems unclear to me.</p>
  <p>I've placed the embedded code on <code>index.html</code>, then created the following</p>
  <p><code>app/reopens/router.js</code></p>
  <pre><code>import Router from '../router';
  
  Router.reopen({
    notifyGoogleAnalytics: function() {
      return ga('send', 'pageview', {
        'page': this.get('url'),
        'title': this.get('url')
      });
    }.on('didTransition')
  });
  </code></pre>
  <p><code>app/app.js</code>: Added the import...</p>
  <pre><code>import './reopens/router';
  </code></pre>
  <p>This results in a fatal error when viewing the site: <code>Uncaught ReferenceError: ga is not defined</code></p>
  <p>How do you make the <code>ga</code> function visible to this observer?</p>