Analytics Plugin - Android
The Android Analytics plugin for Zapp is based on extending the
This class goes through all of the functions for creating a new provider, initializing it and dispatching events.
In order to see a basic implementation of an analytics plugin, we suggest reviewing the Analytics Plugin Sample Project as it's a good starting point for implementing an analytics plugin.
This guide will go through the basic terms and functions that need to be implemented in order to create an analytics plugin.
For more info about Initial Android Plugin Setup, Click Here
Initialization and general properties
The following functions are used to create a plugin for an analytics provider and to configure it..
public void initializeAnalyticsAgent(Context context)
The following function is used to set the parameters from the plugin configuration:
public void setParams(Map params)
The following functions exist to frame a session, called when the app is opened and closed respectively.
public void startTrackingSession(Context context) public void stopTrackingSession(Context context)
The following are the main event logging functions:
public void logEvent(String eventName) public void logEvent(String eventName, TreeMap<String, String> params)
If the analytics provider supports timed events, these functions would be called to track a timed event.
public void startTimedEvent(String eventName) public void startTimedEvent(String eventName, TreeMap<String, String> params) public void endTimedEvent(String eventName)
This function should send or store the User ID (UUID)
public void sendUserID(String userId)
The following functions represent the lifecycle of a player. If the analytics plugin implements player analytics - these events should be implemented.
public void initPlayerSession(Playable playable, PlayerViewWrapper playerWrapper, int duration) public void handlePlayerError(String message) public void logPlayEvent(long currentPosition) /** Track when the player starts playing content */ public void logPlayerEnterBackground() public void logPauseButtonPressed() public void logResumeButtonPressed() public void logPauseEvent(long currentPosition) public void logStopEvent(long currentPosition) public void logVideoEndEvent(long currentPosition) public void logSeekStartEvent(long position) public void logVideoEvent(String eventName, TreeMap<String, String> params) public void logSeekEndEvent(int position) public void logBufferingStartEvent() public void logBufferingEndEvent() public void generalPlayerInfoEvent(Map<String, String> params) public void logFullscreenPressed(int currentPosition)
The following events track the behavior of the base activity for all Zapp applications
public void createTracking(Context context) public void pauseTracking(Context context) public void resumeTracking(Context context)
If the analytics provider supports screen views the following functions should be implemented
public void setScreenView(String screenView)
Events can be marked as blacklisted to be filtered by the analytics provider. In order to test this - from Zapp's specific app plugin configuration screen do the following 2 steps:
Click on the funnel button on the plugin:
Select the unwanted event
The following function checks if an event is blacklisted or not:
public boolean isNotBlacklisted(String eventName)
Track campagin params from URL
Tracking url params if implemented on one of the plugins.
public void trackCampaignParamsFromUrl(String url)