Last active
November 1, 2021 12:59
-
-
Save fmedlin/69b442c90db4e928cf105b95e04154eb to your computer and use it in GitHub Desktop.
Revisions
-
fmedlin revised this gist
Nov 1, 2021 . No changes.There are no files selected for viewing
-
fmedlin created this gist
Nov 1, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ @Override public void track(AnalyticsTracker.Stat stat, String category, String label, Map<String, ?> properties) { if (mNosaraClient == null) { return; } String eventName = stat.name().toLowerCase(); final String user; final TracksClient.NosaraUserType userType; if (mUserName != null) { user = mUserName; userType = TracksClient.NosaraUserType.SIMPLENOTE; } else { // This is just a security checks since the anonID is already available here. // refresh metadata is called on login/logout/startup and it loads/generates the anonId when necessary. if (getAnonID() == null) { user = generateNewAnonID(); } else { user = getAnonID(); } userType = TracksClient.NosaraUserType.ANON; } if (properties != null) { JSONObject propertiesJson = new JSONObject(properties); mNosaraClient.track(EVENTS_PREFIX + eventName, propertiesJson, user, userType); } else { mNosaraClient.track(EVENTS_PREFIX + eventName, user, userType); } }