title: event tracking in google analytics using gtag.js
body: <p>I have recently started learning Google Analytics(GA). I have single page application in Angular. There is a login button in the application. I wanted to track how many users are logged in using GA. So what i did is i created a property in GA and got the tracking id . Then i added the following script just after the in index page.</p>
  
  <p>Now i added the ga() if the login is successful . But unfortunately when i successfully login , i can't find any data in Event Category and Event Action listed in REAL-TIME->Events->bottom most table . I am not able to figure out why?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;!-- Global site tag (gtag.js) - Google Analytics --&gt;
  &lt;script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-X"&gt;&lt;/script&gt;
  &lt;script&gt;
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
  
    gtag('config', 'UA-XXXXXXXX-X');
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$http({enter code here
            method: 'POST',
            'async': true,
            'cache': false,
            'global': false,
            url: //the  correct url,
            isStaySignIn: isStaySignIn,
            isIdamOn: true,
          }).success(function(data, status, headers) {
            $rootScope.Loading = "Loading";
            deferred.resolve({
              data: data,
              headers: headers
            });
            
            ga('send', {
              hitType: 'event',
              eventCategory: 'MODE',
              eventAction: 'IDAM',
              eventLabel: 'Login using Jio ID'
            });
          })</code></pre>
  </div>
  </div>
  </p>