Skip to content

Commit

Permalink
devop: add analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
kvhnuke committed Mar 5, 2024
1 parent 1d55197 commit 60ed48d
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"https://apps.apple.com/app/apple-store/id1464614025?pt=118781877&mt=8&ct=";
const playstore =
"https://play.google.com/store/apps/details?id=com.myetherwallet.mewwallet&referrer=utm_source%3D";
const defaultUrl = "https://www.mewwallet.com";
const defaultUrl = "https://www.mewwallet.com/?referrer=";
const acitivityURL = "https://download.mewwallet.dev/record";
const GENERIC_SHARE = "sharefriend";
const SOURCE = "source";
const getSource = () => {
Expand Down Expand Up @@ -39,18 +40,22 @@
);
},
};
const doTheRedirect = (url, platform, utm) => {
if (!fetch) document.location.href = `${url}${utm}`;
else
fetch(`${acitivityURL}?platform=${platform}&utm=${utm}`).finally(
() => {
document.location.href = `${url}${utm}`;
}
);
};
const utm = getSource() ? getSource() : GENERIC_SHARE;
if (isMobile.Android()) {
//console.log(getSource() ? playstore + getSource() : playstore + GENERIC_SHARE)
document.location.href = getSource()
? playstore + getSource()
: playstore + GENERIC_SHARE;
doTheRedirect(playstore, "android", utm);
} else if (isMobile.iOS()) {
//console.log(getSource() ? appstore + getSource() : appstore + GENERIC_SHARE)
document.location.href = getSource()
? appstore + getSource()
: appstore + GENERIC_SHARE;
doTheRedirect(appstore, "ios", utm);
} else {
document.location.href = defaultUrl;
doTheRedirect(defaultUrl, "web", utm);
}
</script>
</head>
Expand Down

0 comments on commit 60ed48d

Please sign in to comment.