Skip to content

Commit

Permalink
fix: use deviceId instead of uid for uninstallation event mapping (#1668
Browse files Browse the repository at this point in the history
)

* fix: use deviceId instead of uid for uninstallation event mapping

* fix: bring back userId

* chore: remove redundant index.html

* chore: set extension_uninstalled date attribute when sending uninstall event
  • Loading branch information
nsrCodes committed May 14, 2024
1 parent 10408b3 commit f9916bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 246 deletions.
10 changes: 9 additions & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@
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("__amplitude_deviceId")
const uid = localStorage.getItem("__rq_uid")

const eventObject = { device_id: deviceId, event_type: "extension_uninstalled" }
const attributes = {extension_uninstall_date: new Date().toISOString().split("T")[0]}

if(uid) eventObject["user_id"] = uid

if ("https://app.requestly.io/goodbye/" === window.location.href && deviceId) { const a = { api_key: "62ff1b46909e50358cfca0668d41f011", events: [eventObject], user_properties: attributes }, b = new Blob([JSON.stringify(a)]); navigator.sendBeacon("https://api2.amplitude.com/2/httpapi", b) }
</script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
Expand Down
245 changes: 0 additions & 245 deletions app/public/index.html

This file was deleted.

3 changes: 3 additions & 0 deletions app/src/hooks/AuthHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ const AuthHandler: React.FC<{}> = () => {
// Unset isSyncEnabled in window
window.isSyncEnabled = null;
window.keySetDoneisSyncEnabled = true;
localStorage.removeItem("__rq_uid");

// set amplitude anon id to local storage:

dispatch(
// @ts-ignore
Expand Down

0 comments on commit f9916bb

Please sign in to comment.