Don't show an error if analytics fails to activate
This commit is contained in:
parent
da4d462f8c
commit
18d5d66a71
|
@ -18,14 +18,10 @@ class AnalyticsHub {
|
||||||
}
|
}
|
||||||
|
|
||||||
async activate() {
|
async activate() {
|
||||||
try {
|
// Check analytics are enabled
|
||||||
// Check analytics are enabled
|
const analyticsStatus = await API.getAnalyticsStatus()
|
||||||
const analyticsStatus = await API.getAnalyticsStatus()
|
if (analyticsStatus.enabled) {
|
||||||
if (analyticsStatus.enabled) {
|
this.clients.forEach(client => client.init())
|
||||||
this.clients.forEach(client => client.init())
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
notifications.error("Error checking analytics status")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,18 +54,25 @@ export function createAuthStore() {
|
||||||
})
|
})
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
analytics.activate().then(() => {
|
analytics
|
||||||
analytics.identify(user._id, user)
|
.activate()
|
||||||
analytics.showChat({
|
.then(() => {
|
||||||
email: user.email,
|
analytics.identify(user._id, user)
|
||||||
created_at: (user.createdAt || Date.now()) / 1000,
|
analytics.showChat({
|
||||||
name: user.account?.name,
|
email: user.email,
|
||||||
user_id: user._id,
|
created_at: (user.createdAt || Date.now()) / 1000,
|
||||||
tenant: user.tenantId,
|
name: user.account?.name,
|
||||||
"Company size": user.account?.size,
|
user_id: user._id,
|
||||||
"Job role": user.account?.profession,
|
tenant: user.tenantId,
|
||||||
|
"Company size": user.account?.size,
|
||||||
|
"Job role": user.account?.profession,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// This request may fail due to browser extensions blocking requests
|
||||||
|
// containing the word analytics, so we don't want to spam users with
|
||||||
|
// an error here.
|
||||||
})
|
})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue