-
Notifications
You must be signed in to change notification settings - Fork 229
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
snowplow-javascript-tracker/trackers/react-native-tracker/src/plugins/deep_links/index.ts
Lines 52 to 57 in 33ef906
| if (url) { | |
| payload.add(PAGE_URL_PROPERTY, url); | |
| } | |
| if (referrer) { | |
| payload.add(PAGE_REFERRER_PROPERTY, referrer); | |
| } |