Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] AI is not catching all "Unload" dom events #1080

Closed
MSNev opened this issue Oct 7, 2019 · 7 comments
Closed

[Enhancement] AI is not catching all "Unload" dom events #1080

MSNev opened this issue Oct 7, 2019 · 7 comments
Assignees

Comments

@MSNev
Copy link
Collaborator

MSNev commented Oct 7, 2019

Description/Screenshot
The Beforeunload is not the only navigation away event that should be caught the list of events should include

  • beforeunload
  • unload
  • pagehide

It should also be attached to the document as not all browsers (mostly older ones) support the events on window.

@MSNev MSNev self-assigned this Oct 7, 2019
@egrendonDev
Copy link

egrendonDev commented Nov 4, 2019

Hi MSVen,

Have you made any progress on this issue? We are also experiencing similar issues on Desktop Chrome 78. Users appears to randomly have missing application insight events. The options have been set to 100% sampling. And we are are calling "appInsightsFlush()" on every browser "beforeunload" event.

//
//settings
//

	public initAppInsightsAnalytics(): void {
		if (!this.isAppInsightsInitialized) {
			AppInsights.downloadAndSetup({
				instrumentationKey: this.appInsightsKey,
				samplingPercentage: 100 
			});
			this.isAppInsightsInitialized = true;
		}
	}
/**
 * Method will initialize the session expired subscription monitoring
 */
private initBrowserWindowClosedSubscribe() {
	this.windowProvider.browserWindowClosed$
		.pipe(takeUntil(this.subscriptionKiller))
		.subscribe((event: any) => {
				//console.log('Attempt to flush before we close browser window');
				//Attempt to flush AppInsights before we close browser window
				this.appInsights.appInsightsFlush();
			}
		);
}

Thanks,
Ernesto

@MSNev
Copy link
Collaborator Author

MSNev commented Nov 4, 2019

Not yet, as I've been working on the IE8 compatability item, I suspect I should get to this by the end of november (not withstanding the holidays).
The change itself is not that large, I just have a few other high priority items on my work list before I get to this one. The main one that we are missing is the pagehide event (https://developer.mozilla.org/en-US/docs/Web/API/Window/pagehide_event) which is when the user hits the browser back button.

@MSNev
Copy link
Collaborator Author

MSNev commented Nov 8, 2019

Hi Ernesto,

PR created to address this enhancement

Cheers
Nev

@egrendonDev
Copy link

@MSNev - This is great news! ETA on a new possible release?

@MSNev
Copy link
Collaborator Author

MSNev commented Nov 12, 2019

The change should get checked in this week, but I don't have a timeline for when we would push a new release yet. That's probably still the end of Nov unless we end up with some sort of High Priority issue that needs addressing/publishing.

MSNev pushed a commit that referenced this issue Nov 18, 2019
- Fix issues when not running in a browser
MSNev pushed a commit that referenced this issue Nov 19, 2019
- Fix issues when not running in a browser
MSNev pushed a commit that referenced this issue Nov 19, 2019
- Fix issues when not running in a browser
MSNev pushed a commit that referenced this issue Nov 20, 2019
- Fix issues when not running in a browser
MSNev pushed a commit that referenced this issue Nov 20, 2019
- Fix issues when not running in a browser
MSNev added a commit that referenced this issue Nov 20, 2019
- Fix issues when not running in a browser
@MSNev
Copy link
Collaborator Author

MSNev commented Nov 20, 2019

PR checked in and fixed should be included in v2.3.2 or later

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants