Merge pull request #3856 from dpalou/MOBILE-4459

MOBILE-4459 analytics: Don't log analytic events for demo sites
main
Noel De Martin 2023-11-20 10:36:17 +01:00 committed by GitHub
commit 5bd1954b1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -63,7 +63,7 @@ export class CoreAnalyticsService extends CoreDelegate<CoreAnalyticsHandler> {
* @returns True if available, false otherwise. * @returns True if available, false otherwise.
*/ */
async isAnalyticsAvailable(): Promise<boolean> { async isAnalyticsAvailable(): Promise<boolean> {
if (Object.keys(this.enabledHandlers).length > 0) { if (Object.keys(this.enabledHandlers).length > 0 && !CoreSites.getCurrentSite()?.isDemoModeSite()) {
// There is an enabled handler, analytics is available. // There is an enabled handler, analytics is available.
return true; return true;
} }
@ -87,7 +87,7 @@ export class CoreAnalyticsService extends CoreDelegate<CoreAnalyticsHandler> {
*/ */
async logEvent(event: CoreAnalyticsAnyEvent): Promise<void> { async logEvent(event: CoreAnalyticsAnyEvent): Promise<void> {
const site = CoreSites.getCurrentSite(); const site = CoreSites.getCurrentSite();
if (!site) { if (!site || site.isDemoModeSite()) {
return; return;
} }