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

[BUG]: snippet sends pageView if enableAutoRouteTracking = false #2202

Open
VitaliyPotapov opened this issue Nov 21, 2023 · 1 comment
Open
Labels

Comments

@VitaliyPotapov
Copy link

Description/Screenshot
I'm using snippet to setup AppInsights in nextjs app. I track pageView events manually by watching route changes.
So that I have enableAutoRouteTracking: false in my app Insights config.
But when using snippet interface it always sends initial pageView event. Due to that I get duplicates for initial pageView events.

Steps to Reproduce

  1. Setup snippet with enableAutoRouteTracking = false
  2. Open page
  • OS/Browser: OSX, Chrome
  • SDK Version [e.g. 22]: "@microsoft/applicationinsights-web": "^3.0.3",
  • How you initialized the SDK: snippet

Expected behavior
Snippet should not send pageView if enableAutoRouteTracking = false

Additional context

@VitaliyPotapov VitaliyPotapov changed the title [BUG]: snippet sends pageView even if enableAutoRouteTracking = false [BUG]: snippet sends pageView if enableAutoRouteTracking = false Nov 21, 2023
@MSNev
Copy link
Collaborator

MSNev commented Dec 4, 2023

Yes, this is by design so that the SDK completes initialization.

If you don't want this initial "pageview" then you can either not use the snippet, or add / include a telemetry initializer which will be called once the SDK has initialized (and is processing the backlog of queued events -- which will include this trackPageView) and then when you detect this just return false (to cause the event to be dropped).

The initial page view also includes a page view performace event and is the only trackPageview that will cause this performance event to be sent. The auto route tracking (generally) does not cause this event, the only exception is that when using npm packages the performance event is sent as part of the first trackPageview (which is also what happens here as part of this "queued" event).

@MSNev MSNev added the wontfix label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants