[RUM-11677] [V3] Add custom navigation tracking options #1061
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR modifies the automatic navigation tracking modules for React Navigation and React Native Navigation and exposes a new NavigationTrackingOptions parameter through the
startTracking/startTrackingViewsfunction.This options object allows to customize the view tracking logic via 3 new optional predicate functions:
ViewNamePredicate- a custom naming predicates that decide the display name of views tracked by RUM.ViewTrackingPredicate- a custom predicate that decides if a view needs to be tracked by RUM or not.ParamsTrackingPredicate- a custom predicate that decides which navigation parameters (if any) need to be tracked alongside the view on RUM.All of these are optional, and when not set the default behavior will be used for each one of them. The default behaviours are as follows:
ViewNamePredicate- directly forwards the view given name to RUM.ViewTrackingPredicate- tracks all views on RUM.ParamsTrackingPredicate- does not forward any parameters to RUM.Motivation
Many users have expressed the need to be able to customize their view tracking configuration. Hopefully these changes will give them the tools that they need to do so without having to rely on patching files directly.
Review checklist (to be filled by reviewers)