title: Angular - Google analytics not tracking page path changes
body: <p>I have set up google analytics GA4 and added the snippets to my Angular application:</p>
  <p>index.html:</p>
  <pre><code>  &lt;script async src=&quot;https://www.googletagmanager.com/gtag/js?id=G-mytagid&quot;&gt;&lt;/script&gt;
  
    &lt;script&gt;
      window.dataLayer = window.dataLayer || [];
  
      function gtag() {
        dataLayer.push(arguments);
      }
  
      gtag('js', new Date());
    &lt;/script&gt;
  
  </code></pre>
  <p>then in app.component.ts:</p>
  <pre><code>
  this.router.events.subscribe(event =&gt; {
    if (event instanceof NavigationEnd) {
      console.log(event.urlAfterRedirects);
      gtag('config', 'G-mytagid',
        {
          'page_path': event.urlAfterRedirects,
        }
      );
    }
  });
  
  </code></pre>
  <p>Google analytics dashboard detects the page views and changes and also the console also logs the urlAfterRedirects, but on the GA dashboard my application name increments without change in the actual path.
  I am wanting to tack the actual path/ page we are on.</p>
  <p>I am wondering how to do this?</p>
  <p>Thanks</p>