The Anvato Analytics Plugin for Android is a collection of
classes that track both user engagement and video player statistics. Any
media player based on the standard Android media classes (i.e.,
VideoView and MediaPlayer) can use the plugin. Once deployed, it
collects statistics and delivers them to the Anvato Analytics servers.
The plug-in is very lightweight both CPU and bandwidth wise, so you will
not notice anything different about your player after it is installed.
System Requirements
- Android Development SDK
- Anvato Analytics Plugin for Android
- Anvato Analytics Account with Tracker key
Downloads
- Please contact Anvato to download the Android Analytics plugin.
Integration with Android Players
The Android Analytics package contains the following core classes
- com.anvato.analytics.AnvAnalytics: The core analytics class
- com.anvato.player.mediaplayer.AnvMediaPlayer: The class that
extends the standard MediaPlayer
- com.anvato.player.videoview.AnvVideoView: The class that
extends the standard VideoView
And an example video player
- com.anvato.player.simpleplayer.SimpleAnvPlayer: An example
player based on AnvVideoView
Fully embedding the Anvato Plugin requires 2 steps
- 1) Create the player
- 2) Configure dynamic parameters
Creating the Player
Depending on the way your player is implemented you can choose one of the
three ways to enable Anvato Analytics in your player. You player must be based on one of
the standard classes: MediaPlayer or VideoView (which is in turn based on MediaPlayer). The following
examples are given for VideoView but are similarly applicable for MediaPlayer as well by replacing
AnvVideoView with AnvMediaPlayer.
-
(Option 1) Create from the layout:
Replace VideoView in your layout with
com.anvato.player.videoview.AnvVideoView and create the AnvVideoView
directly from your layout such as
<com.anvato.player.videoview.AnvVideoView
android:id="@+id/surface_view" android:layout_width="320px"
android:layout_height="196px"/>
-
(Option 2) Create dynamically:
Instead of instantiating the stock VideoView, instantiate the AnvVideoView such as
import com.anvato.player.videoview.AnvVideoView;
...
AnvVideoView = new AnvVideoView (Context);
-
(Option 3) Extend AnvVideoView:
Instead of extending the stock VideoView, extend the AnvVideoView such as
import com.anvato.player.videoview.AnvVideoView;
...
public class MyVideoView extends AnvVideoView {
...
}
Runtime Configuration
Runtime configuration of the plugin involves setting the tracker ID, creating sessions,
setting video title, etc. The following functions should be called to experience the complete
benefits of the plugin
- Tracker ID (mandatory): AnvVideoView.setAnalyticsTrackerID(String) sets the tracker ID for your player.
- Video Title (optional): AnvVideoView.setAnalyticsTitle(String) sets the title for the current video. If title is left empty, the video URL will be used to group your statistics.
- Player Name (optional): AnvVideoView.setAnalyticsPlayerName(String) sets the player name for your player. This is useful if you have more than one player and you wish to separate statistics.
If your video player is based on MediaPlayer, you should use com.anvato.player.mediaplayer.AnvMediaPlayer instead in the above examples.