Last active
July 25, 2017 21:18
-
-
Save frogermcs/a302df15f632019dbecc94243ed9b526 to your computer and use it in GitHub Desktop.
This file contains 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 characters
public class AnalyticsTools { | |
//Example analytics tools, use whatever you want here | |
private final MixpanelAPI mixpanelAPI; | |
private final GoogleTracker googleTracker; | |
private final FirebaseAnalytics firebaseAnalytics; | |
public AnalyticsTools(MixpanelAPI mixpanelAPI, | |
GoogleTracker googleTracker, | |
FirebaseAnalytics firebaseAnalytics) { | |
this.mixpanelAPI = mixpanelAPI; | |
this.googleTracker = googleTracker; | |
this.firebaseAnalytics = firebaseAnalytics; | |
} | |
public void logScreenLaunch(String screenName) { | |
String eventName = "screenLaunch_" + screenName; | |
//Log screen launch in your favourite analytics tools | |
//mixpanelAPI.trackMap(eventName, new HashMap<>()); | |
//googleTracker.send(eventName); | |
//firebaseAnalytics.logEvent(eventName, ...); | |
//... | |
} | |
public void logButtonClick(String screenName, String buttonLabel) { | |
String eventName = "click_" + screenName + "_" + buttonLabel; | |
//Log button click in your favourite analytics tools | |
//... | |
} | |
public void logCustomEvent(String screenName, String eventLabel, @Nullable Map<String, String> additionalProperties) { | |
String eventName = "custom_" + screenName + "_" + eventLabel; | |
//Log other events in your favourite analytics tools | |
//... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment