added logic to prevet page crashing due to analytics service being unavailable.
This commit is contained in:
parent
8f3d1ee14c
commit
67e854a51f
2 changed files with 29 additions and 8 deletions
|
|
@ -144,18 +144,18 @@ export default {
|
|||
|
||||
const response = await useMainStore().initializeSession(payload);
|
||||
|
||||
if (response.data) {
|
||||
if (response.data.sessionKey && skey === 0) {
|
||||
if (response?.data) {
|
||||
if (response?.data.sessionKey && skey === 0) {
|
||||
setCookieProperties(
|
||||
{ [cookieNames.SESSION_KEY]: response.data.sessionKey },
|
||||
{ [cookieNames.SESSION_KEY]: response?.data.sessionKey },
|
||||
{
|
||||
useDefaultFunnelCookieAttributes: false,
|
||||
}
|
||||
);
|
||||
}
|
||||
if (response.data.sessionId && sid === "00000000-0000-0000-0000-000000000000") {
|
||||
if (response?.data.sessionId && sid === "00000000-0000-0000-0000-000000000000") {
|
||||
setCookieProperties(
|
||||
{ [cookieNames.SESSION_ID]: response.data.sessionId },
|
||||
{ [cookieNames.SESSION_ID]: response?.data.sessionId },
|
||||
{
|
||||
maxAge: 60 * 30, // 30 minutes
|
||||
}
|
||||
|
|
|
|||
|
|
@ -973,7 +973,14 @@ export const useMainStore = defineStore({
|
|||
endpoint: endpoints.LogPageView.url,
|
||||
payload: payload,
|
||||
logApiCall: false
|
||||
});
|
||||
}).then(
|
||||
(response) => {
|
||||
return response;
|
||||
},
|
||||
(error) => {
|
||||
console.log("Analytics Service Error: " + error.data);
|
||||
}
|
||||
);
|
||||
},
|
||||
logCustomEvent({ userId, sessionKey, pageName, sessionId, category, action, label, value, shouldUseSessionId, experimentsForUser})
|
||||
{
|
||||
|
|
@ -999,7 +1006,14 @@ export const useMainStore = defineStore({
|
|||
endpoint: endpoints.LogCustomEvent.url,
|
||||
payload: payload,
|
||||
logApiCall: false
|
||||
});
|
||||
}).then(
|
||||
(response) => {
|
||||
return response;
|
||||
},
|
||||
(error) => {
|
||||
console.log("Analytics Service Error: " + error.data);
|
||||
}
|
||||
);
|
||||
},
|
||||
initializeSession({ userId, sessionId, userAgent, referrer }) {
|
||||
var payload = {
|
||||
|
|
@ -1018,7 +1032,14 @@ export const useMainStore = defineStore({
|
|||
endpoint: endpoints.InitializeSession.url,
|
||||
payload: payload,
|
||||
logApiCall: false
|
||||
});
|
||||
}).then(
|
||||
(response) => {
|
||||
return response;
|
||||
},
|
||||
(error) => {
|
||||
console.log("Analytics Service Error: " + error.data);
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
updateLastPageVisited(lastPageVisited) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue