Skip to content

Add a platform context plugin to the React Native tracker to track device information - #1395

Merged
Matus Tomlein (matus-tomlein) merged 2 commits into
wip/react-nativefrom
issue/react-native-platform-context
Dec 10, 2024
Merged

Add a platform context plugin to the React Native tracker to track device information#1395
Matus Tomlein (matus-tomlein) merged 2 commits into
wip/react-nativefrom
issue/react-native-platform-context

Conversation

@matus-tomlein

Copy link
Copy Markdown
Contributor

Adds the platform context to the React Native tracker that tracks information about the device.

The information available in React Native is quite limited, so only a few properties are auto-tracked: osType, osVersion, deviceManufacturer, deviceModel, resolution, language, scale

The rest can be provided by a platformContextRetriever configuration option. This is the same as on our mobile trackers.

There is also an option to provide platformContextProperties configuration option that filters which properties will be tracked. Also reflects our mobile trackers.

@bundlemon

bundlemon Bot commented Nov 28, 2024

Copy link
Copy Markdown

BundleMon

Files added (6)
Status Path Size Limits
trackers/javascript-tracker/dist/sp.js
+24.54KB 30KB / +10%
libraries/browser-tracker-core/dist/index.mod
ule.js
+23.59KB 25KB / +10%
libraries/tracker-core/dist/index.module.js
+19.5KB 20KB / +10%
trackers/browser-tracker/dist/index.umd.min.j
s
+17.44KB 20KB / +10%
trackers/javascript-tracker/dist/sp.lite.js
+17.39KB 20KB / +10%
trackers/browser-tracker/dist/index.module.js
+3.49KB 5KB / +10%

Total files change +105.95KB 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

/**
* Amount of memory in bytes available to the current app.
* The property is not tracked in the current version of the tracker due to the tracker not being able to access the API, see the issue here: https://github.com/snowplow/snowplow-ios-tracker/issues/772
* Note: this property is not automatically assigned but can be assigned using the PlatformContextRetriever.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it tracked if it's set with PlatformContextRetriever?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's true, when it's manually provided by the PlatformContextRetriever, then it should be added to the platform context.

…vice information

# Conflicts:
#	api-docs/docs/react-native-tracker/markdown/react-native-tracker.reactnativetracker.md
#	api-docs/docs/react-native-tracker/react-native-tracker.api.md
#	trackers/react-native-tracker/src/constants.ts
#	trackers/react-native-tracker/src/tracker.ts
#	trackers/react-native-tracker/test/tracker.test.ts
@matus-tomlein
Matus Tomlein (matus-tomlein) force-pushed the issue/react-native-platform-context branch from 8700480 to 07180aa Compare November 29, 2024 08:48
@matus-tomlein
Matus Tomlein (matus-tomlein) merged commit 45212f0 into wip/react-native Dec 10, 2024
@matus-tomlein
Matus Tomlein (matus-tomlein) deleted the issue/react-native-platform-context branch December 10, 2024 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants