Skip to content

Commit 0426636

Browse files
vaadin-botcaalador
andauthored
feat: disable client statistics (#23371) (#23378)
Disable the client side statistics collection and sending when it is disabled for the server. part of #23357 Co-authored-by: caalador <mikael.grankvist@vaadin.com>
1 parent ed965cd commit 0426636

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

flow-server/src/main/java/com/vaadin/flow/server/communication/IndexHtmlRequestHandler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,8 @@ private void addDevTools(Document indexDocument,
449449
if (isAllowedDevToolsHost(config, request)) {
450450
devToolsConf.put("token", DevToolsToken.getToken());
451451
}
452+
devToolsConf.put("usageStatisticsEnabled",
453+
config.isUsageStatisticsEnabled());
452454
addScript(indexDocument, String.format("""
453455
window.Vaadin.devToolsPlugins = [];
454456
window.Vaadin.devToolsConf = %s;

vaadin-dev-server/src/main/frontend/vaadin-dev-tools.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ type DevToolsConf = {
8181
backend?: string;
8282
liveReloadPort?: number;
8383
token?: string;
84+
usageStatisticsEnabled?: boolean;
8485
};
8586

8687
// @ts-ignore
@@ -709,6 +710,13 @@ export class VaadinDevTools extends LitElement {
709710
if (!VaadinDevTools.isActive) {
710711
frontendConnection.setActive(false);
711712
}
713+
if (this.conf.usageStatisticsEnabled === false) {
714+
localStorage.setItem('vaadin.statistics.optout', 'true');
715+
localStorage.removeItem('vaadin.statistics.basket');
716+
localStorage.removeItem('vaadin.statistics.firstuse');
717+
} else {
718+
localStorage.removeItem('vaadin.statistics.optout');
719+
}
712720
this.elementTelemetry();
713721
};
714722
frontendConnection.onConnectionError = onConnectionError;

0 commit comments

Comments
 (0)