Skip to content

Add new tracker for React Native - #1371

Merged
Matus Tomlein (matus-tomlein) merged 16 commits into
wip/react-nativefrom
issue/create_react_native_tracker
Nov 19, 2024
Merged

Add new tracker for React Native#1371
Matus Tomlein (matus-tomlein) merged 16 commits into
wip/react-nativefrom
issue/create_react_native_tracker

Conversation

@matus-tomlein

@matus-tomlein Matus Tomlein (matus-tomlein) commented Nov 5, 2024

Copy link
Copy Markdown
Contributor

Adds the @snowplow/react-native-tracker package to the monorepo.

This aims to move the React Native tracker to instead of using the iOS and Android trackers as the base for the React Native tracker, to use the JavaScript tracker. The motivation for this is to:

  1. support Expo Go (managed workflow) and React Native for Web
  2. better support React Native new architecture without the interoperability layer
  3. make the tracker easier to maintain going forward (simplifies the project)
  4. be able to use JS tracker plugins (or some of them) in the RN tracker and vice versa

The package will continue with the @snowplow/react-native-tracker starting from version 4.1 (or later). We decided for this as opposed to introducing a new package to make it more clear long term that this package replaces the old RN tracker and avoid having two RN packages. We will need to skip v3 (RN tracker is now on v2) in order to sync with the JS tracker versions.

This PR implements the core of the tracker without additional features (such as session, lifecycle tracking) which will be introduced in follow up PRs. It tries to maintain the API from the RN tracker but for the createTracker method, this was not possible and I think it's better to follow the newTracker convention in the JS tracker. So the newTracker method signature is a breaking change.

I have deployed the package under the version 4.0.1-dev.1 and added a very simple example app in the examples repo using it: snowplow-industry-solutions/snowplow-javascript-tracker-examples#60 (we'll improve it over time)

@matus-tomlein
Matus Tomlein (matus-tomlein) changed the base branch from master to wip/react-native November 5, 2024 09:50
@matus-tomlein
Matus Tomlein (matus-tomlein) marked this pull request as draft November 5, 2024 09:52
@bundlemon

bundlemon Bot commented Nov 5, 2024

Copy link
Copy Markdown

BundleMon

Files added (6)
Status Path Size Limits
trackers/javascript-tracker/dist/sp.js
+24.49KB 30KB / +10%
libraries/browser-tracker-core/dist/index.mod
ule.js
+23.44KB 25KB / +10%
libraries/tracker-core/dist/index.module.js
+19.48KB 20KB / +10%
trackers/browser-tracker/dist/index.umd.min.j
s
+17.4KB 20KB / +10%
trackers/javascript-tracker/dist/sp.lite.js
+17.33KB 20KB / +10%
trackers/browser-tracker/dist/index.module.js
+3.49KB 5KB / +10%

Total files change +105.62KB 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history

Comment thread trackers/react-native-tracker/README.md Outdated
Comment thread trackers/react-native-tracker/src/types.ts Outdated
Comment thread trackers/react-native-tracker/src/subject.ts Outdated
Comment thread trackers/react-native-tracker/src/subject.ts Outdated
Comment thread trackers/react-native-tracker/src/subject.ts
Comment thread trackers/react-native-tracker/src/subject.ts
Comment thread trackers/react-native-tracker/src/events.ts
@matus-tomlein
Matus Tomlein (matus-tomlein) force-pushed the issue/create_react_native_tracker branch from 7ef3a0b to 9094cb3 Compare November 11, 2024 07:48
Comment thread trackers/react-native-tracker/README.md

@greg-el Greg Leonard (greg-el) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work! LGTM

@matus-tomlein
Matus Tomlein (matus-tomlein) merged commit 0a00be2 into wip/react-native Nov 19, 2024
@matus-tomlein
Matus Tomlein (matus-tomlein) deleted the issue/create_react_native_tracker branch November 19, 2024 09:40
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.

3 participants