Discussion (8)1
Log in or sign up to continue

Angular pages are often templates filled with data (via REST) and so it' possible to use that. In the root broker of the application add request tracking (who accessed what and when).

OnPreDispatch method works for that purpose.

/// This method Gets called prior to dispatch of the request. Put any common code here
/// that you want to be executed for EVERY request. If pContinue is set to 0, the
/// request will NOT be dispatched according to the UrlMap. If this case it's the
/// responsibility of the user to return a response.
ClassMethod OnPreDispatch(pUrl As %String, pMethod As %String, ByRef pContinue As %Boolean) As %Status
{
    Quit $$$OK
}

It will not work with Angular or any other modern web application and developed in right way. All pages opened without Cache at all. Web Application is made from static JavaScript, and this app can some time call REST on the server to fetch some data. And sessions now should be endless and stateless. You can only measure server's time.

It should not be a problem. I do Angular2+ application, but I have not done this logging. But, as far as I know, it is possible to subscribe to any routing changes.

import 'rxjs/add/operator/pairwise';
import { Router, ActivatedRoute } from '@angular/router;

export class AppComponent {

  constructor(
    private router: Router,
    private activatedRoute: ActivatedRoute) {
    
    this.router.events
        .filter(event => event instanceof NavigationStart)
        .subscribe((event:NavigationStart) => {
          console.log(event.url)
        });

    // OR
    this.activatedRoute.url.subscribe(url =>{
      console.log(url);
    });
  }

}

And you can then call any API as you want