add umami tracking
This commit is contained in:
parent
67ce374953
commit
3820e63095
@ -1,3 +1,4 @@
|
||||
let UserInfo;
|
||||
async function doAction(url, requestData, successMessage, failureMessage, silent = false) {
|
||||
try {
|
||||
const params = new URLSearchParams();
|
||||
@ -134,7 +135,6 @@ function onPageLoad(){
|
||||
listUsers();
|
||||
}
|
||||
}
|
||||
umami.track();
|
||||
}
|
||||
|
||||
function navigateTo(site, page){
|
||||
@ -147,11 +147,15 @@ function navigateTo(site, page){
|
||||
localStorage.setItem("currentSite", site);
|
||||
localStorage.setItem("currentPage", page);
|
||||
onPageLoad();
|
||||
umami.track();
|
||||
});
|
||||
}
|
||||
|
||||
function softReload(){
|
||||
navigateTo(localStorage.getItem("currentSite"), localStorage.getItem("currentPage"));
|
||||
let currentSite = localStorage.getItem("currentSite");
|
||||
let currentPage = localStorage.getItem("currentPage");
|
||||
navigateTo(currentSite, currentPage);
|
||||
umami.track("softReload");
|
||||
}
|
||||
|
||||
function refreshNavbar(){
|
||||
@ -159,6 +163,7 @@ function refreshNavbar(){
|
||||
action: "getNavigation",
|
||||
};
|
||||
doPageAction(data);
|
||||
umami.track("refreshNavbar");
|
||||
}
|
||||
|
||||
function logout() {
|
||||
@ -169,6 +174,7 @@ function logout() {
|
||||
doAction('/account', data, "Logout Successful!", "Logout failed.").then(() => {
|
||||
refreshNavbar();
|
||||
navigateTo("", localStorage.getItem("defaultPage"));
|
||||
umami.track("logout");
|
||||
});
|
||||
}
|
||||
|
||||
@ -188,6 +194,7 @@ async function doLogin(email, password) {
|
||||
};
|
||||
|
||||
await doAction('/account', data, "Login Successful!", "Login failed. Please check your credentials.");
|
||||
umami.track("login");
|
||||
}
|
||||
|
||||
function register() {
|
||||
@ -211,6 +218,7 @@ function register() {
|
||||
|
||||
async function doRegister(requestData) {
|
||||
await doAction('/account', requestData, "Registration Successful!", "Registration failed.");
|
||||
umami.track("register");
|
||||
}
|
||||
|
||||
//User settings start
|
||||
@ -230,6 +238,7 @@ function changePassword() {
|
||||
|
||||
async function doChangePassword(requestData, successMessage, failureMessage) {
|
||||
await doAction('/account', requestData, successMessage, failureMessage);
|
||||
umami.track("passwordChange");
|
||||
}
|
||||
|
||||
function updateUserProfile() {
|
||||
@ -247,6 +256,7 @@ function updateUserProfile() {
|
||||
};
|
||||
|
||||
doAction('/account', data, "Profile update Successful!", "Profile update failed.");
|
||||
umami.track("updateUserProfile");
|
||||
}
|
||||
|
||||
function updateEmail() {
|
||||
@ -258,6 +268,7 @@ function updateEmail() {
|
||||
};
|
||||
|
||||
doAction('/account', data, "Email update Successful!", "Email update failed.");
|
||||
umami.track("updateEmail");
|
||||
}
|
||||
|
||||
function populateUserInfoFields(userData) {
|
||||
@ -277,6 +288,7 @@ function getUserInfo() {
|
||||
|
||||
if (result && result.Status === "Success") {
|
||||
populateUserInfoFields(result.UserInfo);
|
||||
UserInfo = result.UserInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,6 +307,7 @@ function addActivationCodes() {
|
||||
const result = doAction('/account', data, "Activation codes added Successfully!", "Activation codes addition failed.");
|
||||
|
||||
displayList(result.ActivationCodes, "codeListTable", deleteActivationCode);
|
||||
umami.track("addActivationCodes");
|
||||
}
|
||||
|
||||
function listUsers() {
|
||||
@ -327,6 +340,7 @@ function deleteUser(userId) {
|
||||
|
||||
doAction('/account', data, "User deleted Successfully!", "User deletion failed.");
|
||||
listUsers();
|
||||
umami.track("deleteUser");
|
||||
}
|
||||
|
||||
function deleteActivationCode(activationCode) {
|
||||
@ -337,5 +351,6 @@ function deleteActivationCode(activationCode) {
|
||||
|
||||
doAction('/account', data, "Activation code deleted Successfully!", "Activation code deletion failed.");
|
||||
listActivationCodes();
|
||||
umami.track("deleteActivationCode");
|
||||
}
|
||||
//Admin settings end
|
||||
|
Loading…
Reference in New Issue
Block a user