@@ -4,6 +4,9 @@ import WordPressShared
44/// This enum contains all of the events we track in the app. Please reference the "Woo Mobile Events Draft i2"
55/// spreadsheet for more details.
66///
7+ /// Note: If you would like to exclude site properties (e.g. `blog_id`) for a given event, please
8+ /// add the event to the `WooAnalyticsStat.shouldSendSiteProperties` var.
9+ ///
710public enum WooAnalyticsStat : String {
811
912 // Application Events
@@ -124,6 +127,35 @@ public enum WooAnalyticsStat: String {
124127
125128public extension WooAnalyticsStat {
126129
130+
131+ /// Indicates if site information should be included with this event when it's sent to the tracks server.
132+ /// Returns `true` if it should be included, `false` otherwise.
133+ ///
134+ /// Note: Currently all application-level and authentication events will return false. If you wish
135+ /// to include additional no-site-info events, please add them here.
136+ ///
137+ var shouldSendSiteProperties : Bool {
138+ switch self {
139+ // Application events
140+ case . applicationClosed, . applicationOpened, . applicationUpgraded, . applicationInstalled:
141+ return false
142+ // Authentication Events
143+ case . signedIn, . logout, . openedLogin, . loginFailed,
144+ . loginAutoFillCredentialsFilled, . loginAutoFillCredentialsUpdated, . loginEmailFormViewed, . loginMagicLinkOpenEmailClientViewed,
145+ . loginMagicLinkRequestFormViewed, . loginMagicLinkExited, . loginMagicLinkFailed, . loginMagicLinkOpened,
146+ . loginMagicLinkRequested, . loginMagicLinkSucceeded, . loginPasswordFormViewed, . loginURLFormViewed,
147+ . loginURLHelpScreenViewed, . loginUsernamePasswordFormViewed, . loginTwoFactorFormViewed, . loginEpilogueViewed,
148+ . loginEpilogueStoresShown, . loginEpilogueContinueTapped, . loginProloguePaged, . loginPrologueViewed,
149+ . loginPrologueContinueTapped, . loginPrologueJetpackInstructions, . loginForgotPasswordClicked, . loginSocialButtonClick,
150+ . loginSocialButtonFailure, . loginSocialConnectSuccess, . loginSocialConnectFailure, . loginSocialSuccess,
151+ . loginSocialFailure, . loginSocial2faNeeded, . loginSocialAccountsNeedConnecting, . loginSocialErrorUnknownUser,
152+ . onePasswordFailed, . onePasswordLogin, . onePasswordSignup, . twoFactorCodeRequested, . twoFactorSentSMS:
153+ return false
154+ default :
155+ return true
156+ }
157+ }
158+
127159 /// Converts the provided WPAnalyticsStat into a WooAnalyticsStat.
128160 /// This whole process kinda stinks, but we need this for the `WordPressAuthenticatorDelegate`
129161 /// implementation. ☹️ Feel free to refactor later on!
0 commit comments