From 03ea4abb8efa9ac43f004ce51bfdaa5fe5b95278 Mon Sep 17 00:00:00 2001 From: Maxime Biais Date: Tue, 5 Jan 2016 16:08:10 +0100 Subject: [PATCH] Add visual editor events to mixpanel and nosara trackers --- .../analytics/AnalyticsTrackerMixpanel.java | 63 +++++++++++++++++++ .../analytics/AnalyticsTrackerNosara.java | 37 +++++++++++ 2 files changed, 100 insertions(+) diff --git a/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerMixpanel.java b/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerMixpanel.java index 16a1761a6ad0..79cbb31570c5 100644 --- a/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerMixpanel.java +++ b/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerMixpanel.java @@ -403,6 +403,45 @@ private AnalyticsTrackerMixpanelInstructionsForStat instructionsForStat( instructions.setSuperPropertyAndPeoplePropertyToIncrement("number_of_times_editor_saved_draft"); instructions.setCurrentDateForPeopleProperty("last_time_saved_draft"); break; + case EDITOR_DISCARDED_CHANGES: + instructions = AnalyticsTrackerMixpanelInstructionsForStat. + mixpanelInstructionsForEventName("Editor - Discarded Changes"); + instructions.setSuperPropertyAndPeoplePropertyToIncrement("number_of_times_editor_discarded_changes"); + instructions.setCurrentDateForPeopleProperty("last_time_discarded_changes"); + break; + case EDITOR_EDITED_IMAGE: + instructions = AnalyticsTrackerMixpanelInstructionsForStat. + mixpanelInstructionsForEventName("Editor - Edited Image"); + instructions.setSuperPropertyAndPeoplePropertyToIncrement("number_of_times_editor_edited_image"); + instructions.setCurrentDateForPeopleProperty("last_time_edited_image"); + break; + case EDITOR_ENABLED_NEW_VERSION: + instructions = AnalyticsTrackerMixpanelInstructionsForStat. + mixpanelInstructionsForEventName("Editor - Enabled New Version"); + instructions.addSuperPropertyToFlag("enabled_new_editor"); + break; + case EDITOR_TOGGLED_ON: + instructions = AnalyticsTrackerMixpanelInstructionsForStat. + mixpanelInstructionsForEventName("Editor - Toggled New Editor On"); + instructions.setPeoplePropertyToValue("enabled_new_editor", true); + break; + case EDITOR_TOGGLED_OFF: + instructions = AnalyticsTrackerMixpanelInstructionsForStat. + mixpanelInstructionsForEventName("Editor - Toggled New Editor Off"); + instructions.setPeoplePropertyToValue("enabled_new_editor", true); + break; + case EDITOR_UPDLOAD_MEDIA_FAILED: + instructions = AnalyticsTrackerMixpanelInstructionsForStat. + mixpanelInstructionsForEventName("Editor - Upload Media Failed"); + instructions.setSuperPropertyAndPeoplePropertyToIncrement("number_of_times_editor_upload_media_failed"); + instructions.setCurrentDateForPeopleProperty("last_time_editor_upload_media_failed"); + break; + case EDITOR_UPDLOAD_MEDIA_RETRIED: + instructions = AnalyticsTrackerMixpanelInstructionsForStat. + mixpanelInstructionsForEventName("Editor - Retried Uploading Media"); + instructions.setSuperPropertyAndPeoplePropertyToIncrement("number_of_times_editor_retried_uploading_media"); + instructions.setCurrentDateForPeopleProperty("last_time_editor_retried_uploading_media"); + break; case EDITOR_CLOSED: instructions = AnalyticsTrackerMixpanelInstructionsForStat. mixpanelInstructionsForEventName("Editor - Closed"); @@ -502,6 +541,30 @@ private AnalyticsTrackerMixpanelInstructionsForStat instructionsForStat( instructions.setSuperPropertyAndPeoplePropertyToIncrement("number_of_times_editor_tapped_underline"); instructions.setCurrentDateForPeopleProperty("last_time_tapped_underline_in_editor"); break; + case EDITOR_TAPPED_HTML: + instructions = AnalyticsTrackerMixpanelInstructionsForStat. + mixpanelInstructionsForEventName("Editor - Tapped HTML Button"); + instructions.setSuperPropertyAndPeoplePropertyToIncrement("number_of_times_editor_tapped_html"); + instructions.setCurrentDateForPeopleProperty("last_time_tapped_html_in_editor"); + break; + case EDITOR_TAPPED_ORDERED_LIST: + instructions = AnalyticsTrackerMixpanelInstructionsForStat. + mixpanelInstructionsForEventName("Editor - Tapped Ordered List Button"); + instructions.setSuperPropertyAndPeoplePropertyToIncrement("number_of_times_editor_tapped_ordered_list"); + instructions.setCurrentDateForPeopleProperty("last_time_tapped_ordered_list_in_editor"); + break; + case EDITOR_TAPPED_UNLINK: + instructions = AnalyticsTrackerMixpanelInstructionsForStat. + mixpanelInstructionsForEventName("Editor - Tapped Unlink Button"); + instructions.setSuperPropertyAndPeoplePropertyToIncrement("number_of_times_editor_tapped_unlink"); + instructions.setCurrentDateForPeopleProperty("last_time_tapped_unlink_in_editor"); + break; + case EDITOR_TAPPED_UNORDERED_LIST: + instructions = AnalyticsTrackerMixpanelInstructionsForStat. + mixpanelInstructionsForEventName("Editor - Tapped Unordered List Button"); + instructions.setSuperPropertyAndPeoplePropertyToIncrement("number_of_times_editor_tapped_unordered_list"); + instructions.setCurrentDateForPeopleProperty("last_time_tapped_unordered_list_in_editor"); + break; case NOTIFICATIONS_ACCESSED: instructions = AnalyticsTrackerMixpanelInstructionsForStat. mixpanelInstructionsForEventName("Notifications - Accessed"); diff --git a/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java b/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java index d814d59dc73d..5c15e29c1eda 100644 --- a/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java +++ b/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java @@ -120,6 +120,27 @@ public void track(AnalyticsTracker.Stat stat, Map properties) { case EDITOR_SAVED_DRAFT: eventName = "editor_draft_saved"; break; + case EDITOR_DISCARDED_CHANGES: + eventName = "editor_discarded_changes"; + break; + case EDITOR_EDITED_IMAGE: + eventName = "editor_image_edited"; + break; + case EDITOR_ENABLED_NEW_VERSION: + eventName = "editor_enabled_new_version"; + break; + case EDITOR_TOGGLED_OFF: + eventName = "editor_toggled_off"; + break; + case EDITOR_TOGGLED_ON: + eventName = "editor_toggled_on"; + break; + case EDITOR_UPDLOAD_MEDIA_FAILED: + eventName = "editor_upload_media_failed"; + break; + case EDITOR_UPDLOAD_MEDIA_RETRIED: + eventName = "editor_upload_media_retried"; + break; case EDITOR_CLOSED: eventName = "editor_closed"; break; @@ -180,6 +201,22 @@ public void track(AnalyticsTracker.Stat stat, Map properties) { eventName = "editor_button_tapped"; predefinedEventProperties.put("button", "underline"); break; + case EDITOR_TAPPED_HTML: + eventName = "editor_button_tapped"; + predefinedEventProperties.put("button", "html"); + break; + case EDITOR_TAPPED_ORDERED_LIST: + eventName = "editor_button_tapped"; + predefinedEventProperties.put("button", "ordered_list"); + break; + case EDITOR_TAPPED_UNLINK: + eventName = "editor_button_tapped"; + predefinedEventProperties.put("button", "unlink"); + break; + case EDITOR_TAPPED_UNORDERED_LIST: + eventName = "editor_button_tapped"; + predefinedEventProperties.put("button", "unordered_list"); + break; case NOTIFICATIONS_ACCESSED: eventName = "notifications_accessed"; break;