Skip to content
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

Merged
merged 4 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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