New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use deviceId instead of uid for uninstallation event mapping #1668
Conversation
Here's the code health analysis summary for commits Analysis Summary
|
app/src/hooks/AuthHandler.ts
Outdated
@@ -90,7 +90,6 @@ const AuthHandler: React.FC<{}> = () => { | |||
Logger.timeLog("AuthHandler-blockingOperations", "START"); | |||
const authData = getAuthData(user); | |||
window.uid = user.uid; | |||
localStorage.setItem("__rq_uid", user.uid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need this
app/public/index.html
Outdated
@@ -11,7 +11,8 @@ | |||
window.location.href = 'https://app.requestly.io'; | |||
} | |||
|
|||
if ("https://app.requestly.io/goodbye/" === window.location.href) { const a = { api_key: "62ff1b46909e50358cfca0668d41f011", events: [{ user_id: localStorage.getItem("__rq_uid") || Math.random().toString(36).slice(2, 10), event_type: "extension_uninstalled" }] }, b = new Blob([JSON.stringify(a)]); navigator.sendBeacon("https://api2.amplitude.com/2/httpapi", b) } | |||
const deviceId = localStorage.getItem("__rq_device_id") | |||
if ("https://app.requestly.io/goodbye/" === window.location.href && deviceId) { const a = { api_key: "62ff1b46909e50358cfca0668d41f011", events: [{ device_id: deviceId, event_type: "extension_uninstalled" }] }, b = new Blob([JSON.stringify(a)]); navigator.sendBeacon("https://api2.amplitude.com/2/httpapi", b) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use uid first and if it is not found, then we should use the deviceId.
app/public/index.html
Outdated
@@ -11,7 +11,8 @@ | |||
window.location.href = 'https://app.requestly.io'; | |||
} | |||
|
|||
if ("https://app.requestly.io/goodbye/" === window.location.href) { const a = { api_key: "62ff1b46909e50358cfca0668d41f011", events: [{ user_id: localStorage.getItem("__rq_uid") || Math.random().toString(36).slice(2, 10), event_type: "extension_uninstalled" }] }, b = new Blob([JSON.stringify(a)]); navigator.sendBeacon("https://api2.amplitude.com/2/httpapi", b) } | |||
const deviceId = localStorage.getItem("__rq_device_id") | |||
if ("https://app.requestly.io/goodbye/" === window.location.href && deviceId) { const a = { api_key: "62ff1b46909e50358cfca0668d41f011", events: [{ device_id: deviceId, event_type: "extension_uninstalled" }] }, b = new Blob([JSON.stringify(a)]); navigator.sendBeacon("https://api2.amplitude.com/2/httpapi", b) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to set extension_uninstall_date
attribute too on uninstall
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setting attributes is not available in the http api
app/public/index.html
Outdated
@@ -11,7 +11,8 @@ | |||
window.location.href = 'https://app.requestly.io'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is deprecated when we shifter to vite. Please delete this file to avoid confusion in future
The locally stored user id has many problems:
shifting to using the deviceId instead