diff --git a/analytics/management/commands/update_analytics_counts.py b/analytics/management/commands/update_analytics_counts.py index 0a9d4c9977..fa4e89a1da 100644 --- a/analytics/management/commands/update_analytics_counts.py +++ b/analytics/management/commands/update_analytics_counts.py @@ -11,6 +11,7 @@ from django.utils.timezone import utc as timezone_utc from analytics.lib.counts import COUNT_STATS, logger, process_count_stat from scripts.lib.zulip_tools import ENDC, WARNING +from zerver.lib.remote_server import send_analytics_to_remote_server from zerver.lib.timestamp import floor_to_hour from zerver.models import Realm @@ -84,3 +85,6 @@ class Command(BaseCommand): print("Finished updating analytics counts through %s in %.3fs" % (fill_to_time, time.time() - start)) logger.info("Finished updating analytics counts through %s" % (fill_to_time,)) + + if settings.PUSH_NOTIFICATION_BOUNCER_URL and settings.SUBMIT_USAGE_STATISTICS: + send_analytics_to_remote_server() diff --git a/docs/production/mobile-push-notifications.md b/docs/production/mobile-push-notifications.md index 6aed5e0264..9ca7ddf3c7 100644 --- a/docs/production/mobile-push-notifications.md +++ b/docs/production/mobile-push-notifications.md @@ -130,6 +130,21 @@ and privacy in mind: If you have any questions about the security model, contact support@zulipchat.com. +## Submitting statistics + +Systems using the Mobile Push Notifications Service will, by default, +submit basic usage statistics (e.g. Zulip version, number of users, +number of messages sent) to the service. These statistics help the +Zulip open source project understand how many people are using Zulip, +and help us allocate resources towards supporting self-hosted +installations. + +Our use of these statistics is governed by the same ToS and +Privacy Policy that covers the Mobile Push Notifications Service +itself. If your organization does not want to submit these +statistics, you can disable this feature at any time by setting +`SUBMIT_USAGE_STATISTICS=False` in `/etc/zulip/settings.py`. + ## Legacy signup Here are legacy instructions for signing a server up for push diff --git a/zerver/lib/remote_server.py b/zerver/lib/remote_server.py index 6de99bea0d..cc1feaa2f8 100644 --- a/zerver/lib/remote_server.py +++ b/zerver/lib/remote_server.py @@ -131,6 +131,7 @@ def send_analytics_to_remote_server() -> None: request = { 'realm_counts': ujson.dumps(realm_count_data), 'installation_counts': ujson.dumps(installation_count_data), + 'version': ujson.dumps(ZULIP_VERSION), } # Gather only entries with an ID greater than last_realm_count_id diff --git a/zproject/prod_settings_template.py b/zproject/prod_settings_template.py index 1f18f010d5..57ef8e09e9 100644 --- a/zproject/prod_settings_template.py +++ b/zproject/prod_settings_template.py @@ -223,6 +223,13 @@ SSO_APPEND_DOMAIN = None # type: Optional[str] # notification encryption feature. #PUSH_NOTIFICATION_REDACT_CONTENT = False +# Whether to submit basic usage statistics to help the Zulip core team. Details at +# +# https://zulip.readthedocs.io/en/latest/production/mobile-push-notifications.html +# +# Defaults to True if and only if the Mobile Push Notifications Service is enabled. +#SUBMIT_USAGE_STATISTICS = True + # Controls whether session cookies expire when the browser closes SESSION_EXPIRE_AT_BROWSER_CLOSE = False diff --git a/zproject/settings.py b/zproject/settings.py index 72bf6444f1..3712ed5173 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -226,6 +226,7 @@ DEFAULT_SETTINGS = { 'PASSWORD_MIN_GUESSES': 10000, 'PUSH_NOTIFICATION_BOUNCER_URL': None, 'PUSH_NOTIFICATION_REDACT_CONTENT': False, + 'SUBMIT_USAGE_STATISTICS': True, 'RATE_LIMITING': True, 'SEND_LOGIN_EMAILS': True, 'EMBEDDED_BOTS_ENABLED': False,