Sending Brightcove Analytics from the Native SDK for Android
If you use the Brightcove player and
catalog included in the SDK to retrieve and play videos, analytics data will be automatically collected and will appear in the Video Cloud Analytics module.
If you override the
BrightcoveVideoView class or do not use the Brightcove player and catalog, you need to send your Account Id to Video Cloud Analytics.
As of version 4.2.7 of the Brightcove Mobile SDK for Android, you can send custom values to Brightcove Analytics from your app for Account Id, Destination URI and Source URI.
Your Account Id is required, but is automatically set when you use the Brightcove player and the
You can set the Destination and Source URIs if you choose. The default values are based on the application package name.
These properties can be set in your Android
MainActivity class file:
brightcoveVideoView = (SeamlessVideoView) findViewById(R.id.brightcove_video_view); Analytics analytics = brightcoveVideoView.getAnalytics(); analytics.setAccount("your accountID"); analytics.setDestination("valid URI"); analytics.setSource("valid URI");
account property to set the Account Id value in Brightcove Analytics. This property will be useful only in cases where there is no
accountId value in the video’s metadata (for example, if your app uses a mix of Video Cloud videos, which contain the
accountId property, and non-Video Cloud videos, which will not contain the
For example, you can set the accountId property as follows:
When you set the account property, the value of this property will be used for any of your videos which do not already have an
accountId property. The most useful value for this property is your own Account Id. These videos will be reported in the Analytics module as Other/Third Party since Brightcove Analytics does not currently support detailed reporting for videos that are not retrieved through the Brightcove Catalog service.
For Video Cloud videos, setting this account override has no effect on reporting, since the video's
accountId metadata value remains unchanged. That value can not be overridden by setting this account value.
destination property to set the value of the location that originates the event. The value of the destination property MUST be in proper URI format, similar to this example:
The default value the destination property is
bcsdk:// followed by the app name, followed by the package name.
For example, in the Android SDK HLS Sample App, the destination value would be:
Any screen in your app that instantiates a
brightcoveVideoView can set this destination override to a distinct value, to better track video views within the app itself.
source property to set the URI that sent the end-user to the destination URI. As with the destination value, the value of the source property MUST be in proper URI format, similar to this example:
The default value of the source property is null. When the value is null, the source property is not sent to the Analytics server.
For example, you can set the source property as follows:
Note: For more details about URI structures for use in the destination and source fields, see the URI Scheme Wikipedia page. You can use a tool like this URL Encoder to convert characters into UTF-8 encoding format.
In the Video Cloud Analytics module, you can view metric data at the account level or at a detailed level such as by video.To learn how, view the following docs:
Note: Brightcove Analytics converts the destination and source values you’ve set to an all lower-case string value in all reports.