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