From d8fb190734c5f7f1badef8efe6884fb7cf7fd5b6 Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Mon, 2 Oct 2023 09:23:47 +0100 Subject: [PATCH] Merge pull request #5737 from seadowg/partial-analytics Track partial form submissions --- .../org/odk/collect/android/analytics/AnalyticsEvents.kt | 5 +++++ .../java/org/odk/collect/android/tasks/SaveFormToDisk.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/collect_app/src/main/java/org/odk/collect/android/analytics/AnalyticsEvents.kt b/collect_app/src/main/java/org/odk/collect/android/analytics/AnalyticsEvents.kt index 17ed48382c9..9c407a87053 100644 --- a/collect_app/src/main/java/org/odk/collect/android/analytics/AnalyticsEvents.kt +++ b/collect_app/src/main/java/org/odk/collect/android/analytics/AnalyticsEvents.kt @@ -173,4 +173,9 @@ object AnalyticsEvents { * Tracks how often form-level auto-send setting is used */ const val FORM_LEVEL_AUTO_SEND = "FormLevelAutoSend" + + /** + * Tracks how often a form is finalized using a `ref` attribute on the `submission` element + */ + const val PARTIAL_FORM_FINALIZED = "PartialFormFinalized" } diff --git a/collect_app/src/main/java/org/odk/collect/android/tasks/SaveFormToDisk.java b/collect_app/src/main/java/org/odk/collect/android/tasks/SaveFormToDisk.java index eeda03d4ed3..e495e3effa8 100644 --- a/collect_app/src/main/java/org/odk/collect/android/tasks/SaveFormToDisk.java +++ b/collect_app/src/main/java/org/odk/collect/android/tasks/SaveFormToDisk.java @@ -39,6 +39,7 @@ import org.json.JSONException; import org.json.JSONObject; import org.odk.collect.analytics.Analytics; +import org.odk.collect.android.analytics.AnalyticsEvents; import org.odk.collect.android.application.Collect; import org.odk.collect.android.database.instances.DatabaseInstanceColumns; import org.odk.collect.android.exception.EncryptionException; @@ -361,6 +362,10 @@ private Instance exportData(boolean markCompleted, FormSaver.ProgressListener pr // now see if the packaging of the data for the server would make it // non-reopenable (e.g., encryption or other fraction of the form). boolean canEditAfterCompleted = formController.isSubmissionEntireForm(); + if (!canEditAfterCompleted) { + Analytics.log(AnalyticsEvents.PARTIAL_FORM_FINALIZED, "form"); + } + boolean isEncrypted = false; // build a submission.xml to hold the data being submitted