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

Custom page view names for SPAs #20

Open
bgc-andrew opened this issue Aug 28, 2022 · 1 comment
Open

Custom page view names for SPAs #20

bgc-andrew opened this issue Aug 28, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@bgc-andrew
Copy link

When I use the plugin as documented for a React SPA with router v6, the name for all page views is the page title ("React App" by default). This makes it difficult to track user progress through the application. I was able to solve this using the following telemetry initializer but this doesn't seem very elegant.

appInsights.addTelemetryInitializer((env) => { if(env.baseType === "PageviewData" || env.baseType === "PageviewPerformanceData") { env.baseData.name = window.location.pathname; } });

It would be great for developers to be able to specify how to obtain the page name rather than having to modify it after the fact with a telemetry initializer. Alternatively, if the above approach is the recommended method, adding it to the official documentation would be helpful.

@MSNev
Copy link
Contributor

MSNev commented Feb 3, 2023

Sorry, this should have been responded to a while ago...

I've created a feature request on Application Insights to provide this functionality
microsoft/ApplicationInsights-JS#1986

@MSNev MSNev added the enhancement New feature or request label Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants