Sending Brightcove Analytics from the Native SDK for iOS

Product(s)
Video Cloud
Role(s)
Device SDK Developer
Topic(s)
Analytics
SDK
iOS

In this topic, you will learn how to set properties in Brightcove Analytics from your mobile app using the Brightcove SDK for iOS.

Analytics integration

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 BCOVVideo class or do not use the Brightcove player and catalog, you need to send your Account Id to Video Cloud Analytics.

Customize properties

As of version 4.1.8 of the Brightcove Mobile SDK for iOS, 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 catalog.

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 ViewController implementation file. This is typically done after the call to create the PlaybackController:

id<BCOVPlaybackController> controller =
    [[BCOVPlayerSDKManager sharedManager] createPlaybackController];

controller.analytics.account = your accountId;
controller.analytics.destination = valid URI;
controller.analytics.source = valid URI;

Account

Use the 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 accountId property).

controller.analytics.account = @"your accountId";

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

Use the 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:

bcsdk://com.mhogben.source

The default value the destination property is bcsdk:// followed by the app's bundle identifier as listed in the app's info.plist file.

For example, in an iOS Sample app, the default destination value would be bcsdk://com.brightcove.sampleAppMainScreen.Destination and it could be overridden like this:

controller.analytics.destination =
    @"myapp://com.mycompany.homescreen.destination";

Any screen in your app that instantiates a BCOVPlaybackController can set this destination override to a distinct value, to better track video views within the app itself.

Source

Use the 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:

bcsdk://com.mhogben.source

The default value of the source property is nil. When the value is nil, the source property is not sent to the Analytics server.

Here is an example of how to set the source property:

controller.analytics.source =
    @"myapp://com.mycompany.homescreen.destination.source";

View analytics

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: