I'm trying to get a timestamp for every time a page is accessed and another timestamp when the user leaves the page. I get the time Oninit, however 'OnDestroy' I get the same exact time when of when the page was accessed.
entryTime = Date.now();
exitTime = new Date();
ngOnInit(): void {
console.log(this.entryTime);
}
ngOnDestroy(): void {
console.log(this.exitTime);
}
Call this inside ngDestroy and then console