snowplow / snowplow/snowplow-javascript-tracker
Support setting url and referrer in RN tracker
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 590
- Forks
- 232
- Avg merge
- 2h 22m
- Merged PRs (30d)
- 3
Description
Is your feature request related to a problem? Please describe.
The v4 react native tracker if used on web misses out on browser context information. There's no way to set the url or refr on the react native tracker. This blocks me from simplifying down to just the react-native-tracker for all platforms.
Having a way to set those on mobile environment would also be helpful. (I use expo-router so even on mobile everything maps cleanly to a URL).
Describe the solution you'd like
Add support for setReferrerUrl & setCustomUrl.
Maybe also support other fields that the getBrowserDataPlugin does for browser tracker.
Describe alternatives you've considered
DIYing the plugin
function browserDataPlugin() {
let customUrl: string | undefined | null = undefined;
const beforeTrack = (payloadBuilder: PayloadBuilder) => {
customUrl && payloadBuilder.add('url', customUrl);
};
const setCustomUrl = (url: string | null) => {
customUrl = url;
};
return {
setCustomUrl,
plugin: {
beforeTrack,
},
};
}
tracker.addPlugin(browserDataPlugin());
Additional context
Setting url in any capacity on mobile seems like it may some conflict with the deeplink plugins way of doing this
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the React Native tracker and the getBrowserDataPlugin behavior described in the issue, then inspect trackers/react-native-tracker/src/plugins/deep_links/index.ts around the referenced lines. Determine how setReferrerUrl and setCustomUrl should interact with deep-link URL handling; done means the React Native tracker can set url and referrer values without conflicting with that plugin.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100