Inform that the user that config keys are missing (#880)
This commit is contained in:
parent
aabca7ebff
commit
eda11cfc08
2 changed files with 6 additions and 5 deletions
|
@ -94,7 +94,7 @@ export class PosthogAnalytics {
|
||||||
private static ANALYTICS_EVENT_TYPE = "im.vector.analytics";
|
private static ANALYTICS_EVENT_TYPE = "im.vector.analytics";
|
||||||
|
|
||||||
// set true during the constructor if posthog config is present, otherwise false
|
// set true during the constructor if posthog config is present, otherwise false
|
||||||
private static internalInstance = null;
|
private static internalInstance: PosthogAnalytics | null = null;
|
||||||
|
|
||||||
private identificationPromise: Promise<void>;
|
private identificationPromise: Promise<void>;
|
||||||
private readonly enabled: boolean = false;
|
private readonly enabled: boolean = false;
|
||||||
|
@ -137,6 +137,9 @@ export class PosthogAnalytics {
|
||||||
});
|
});
|
||||||
this.enabled = true;
|
this.enabled = true;
|
||||||
} else {
|
} else {
|
||||||
|
logger.info(
|
||||||
|
"Posthog is not enabled because there is no api key or no host given in the config"
|
||||||
|
);
|
||||||
this.enabled = false;
|
this.enabled = false;
|
||||||
}
|
}
|
||||||
this.startListeningToSettingsChanges();
|
this.startListeningToSettingsChanges();
|
||||||
|
@ -225,9 +228,7 @@ export class PosthogAnalytics {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async identifyUser(analyticsIdGenerator: () => string) {
|
public async identifyUser(analyticsIdGenerator: () => string) {
|
||||||
// There might be a better way to get the client here.
|
if (this.anonymity == Anonymity.Pseudonymous && this.enabled) {
|
||||||
|
|
||||||
if (this.anonymity == Anonymity.Pseudonymous) {
|
|
||||||
// Check the user's account_data for an analytics ID to use. Storing the ID in account_data allows
|
// Check the user's account_data for an analytics ID to use. Storing the ID in account_data allows
|
||||||
// different devices to send the same ID.
|
// different devices to send the same ID.
|
||||||
let analyticsID = await this.getAnalyticsId();
|
let analyticsID = await this.getAnalyticsId();
|
||||||
|
|
|
@ -214,5 +214,5 @@ export class Initializer {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private initPromise: Promise<void>;
|
private initPromise: Promise<void> | null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue