Don't show an error if analytics fails to activate
This commit is contained in:
parent
81558588dc
commit
e1a1d47238
|
@ -18,14 +18,10 @@ class AnalyticsHub {
|
|||
}
|
||||
|
||||
async activate() {
|
||||
try {
|
||||
// Check analytics are enabled
|
||||
const analyticsStatus = await API.getAnalyticsStatus()
|
||||
if (analyticsStatus.enabled) {
|
||||
this.clients.forEach(client => client.init())
|
||||
}
|
||||
} catch (error) {
|
||||
notifications.error("Error checking analytics status")
|
||||
// Check analytics are enabled
|
||||
const analyticsStatus = await API.getAnalyticsStatus()
|
||||
if (analyticsStatus.enabled) {
|
||||
this.clients.forEach(client => client.init())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,18 +54,25 @@ export function createAuthStore() {
|
|||
})
|
||||
|
||||
if (user) {
|
||||
analytics.activate().then(() => {
|
||||
analytics.identify(user._id, user)
|
||||
analytics.showChat({
|
||||
email: user.email,
|
||||
created_at: (user.createdAt || Date.now()) / 1000,
|
||||
name: user.account?.name,
|
||||
user_id: user._id,
|
||||
tenant: user.tenantId,
|
||||
"Company size": user.account?.size,
|
||||
"Job role": user.account?.profession,
|
||||
analytics
|
||||
.activate()
|
||||
.then(() => {
|
||||
analytics.identify(user._id, user)
|
||||
analytics.showChat({
|
||||
email: user.email,
|
||||
created_at: (user.createdAt || Date.now()) / 1000,
|
||||
name: user.account?.name,
|
||||
user_id: user._id,
|
||||
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