Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Analytics Kotlin comScore Plugin


Getting started

getting-started page anchor
  1. From the Segment web app, click Catalog.
  2. Search for comScore in the Catalog, select it, and choose which of your sources to connect the destination to.
  3. In Destination Settings, add the c2 ID. You can find your c2 option when you enter your domain and press Get Tag at comScore Direct. The c2 option is on line 4 of the Tag Code.

To install the Segment-comScore integration, add this line to your gradle file:

implementation 'com.segment.analytics.kotlin.destinations:comscore:<latest_version>'

Or the following for Kotlin DSL:

implementation('com.segment.analytics.kotlin.destinations:comscore:<latest_version>')

Using the plugin in your app

using-the-plugin-in-your-app page anchor

Open the file where you set up and configure the Analytics-Kotlin library. Add this plugin to the list of imports.

import com.segment.analytics.kotlin.destinations.comscore

Under your Analytics-Kotlin library setup, call analytics.add(plugin = ...) to add an instance of the plugin to the Analytics timeline.

1
analytics = Analytics("<YOUR WRITE KEY>", applicationContext) {
2
this.flushAt = 3
3
this.trackApplicationLifecycleEvents = true
4
}
5
analytics.add(plugin = ComscoreDestination())

Your events will now begin to flow to comScore in device mode.


Calling Identify with comScore enabled sets the user attributes provided as labels, and passes that information to comScore. With the mobile destination, Segment maps the Identify event to comScore's setPersistentLabelWithName.


Calling Track on events sets the properties of that track call as hidden values in comScore to enhance your reports. With the mobile destination, Segment maps the Track event to comScore's notifyHiddenEventWithLabels.


Calling Screen on mobile attributes the name, category and properties on that call to be used in the comScore tool. With the mobile destination, Segment maps the Screenevent to comScore'snotifyViewEventWithLabels`.


Calling Flush will clear the offline cache with comScore's flushOfflineCache method.


(information)

Info

The video tracking functionality is in beta for mobile only, and requires version 3.0.0 of the Segment-comScore SDK. If you have feedback on or questions about this beta feature, contact Support(link takes you to an external page).

To get started tracking video content through Segment, make sure you are using a media player that has an API which allows you to detect the player state. Refer to the Video Spec and implement video tracking as outlined there. Segment map the semantic events to comScore's relevant methods.

Playback events

playback-events page anchor

When you call Video Playback Started, Segment initializes an instance of the comScore streamingAnalytics class with [streamingAnalytics createPlaybackSession];. It is essential that this event is called in order to continue tracking through comScore's Streaming Tag.

From there Segment maps to the relevant events on the instance as outlined below:

comScore SpecSegment Video Spec
notifyPauseVideo Playback Paused
notifyBufferStartVideo Playback Buffer Started
notifyBufferStopVideo Playback Buffer Completed
notifySeekStartVideo Playback Seek Started
notifyPlayVideo Playback Seek Completed
notifyPlayVideo Playback Resumed

If the properties.position is passed in, Segment calls the above methods with the play position.

Playback properties (labels)

For each playback event, Segment sets the following asset labels translated from the video spec to comScore:

comScore LabelSegment Property
ns_st_ciasset_ids(s)
ns_st_mpvideo_player
ns_st_vosound
ns_st_wsfull_screen
ns_st_brbitrate

Note that iOS and Android expect different casing. Segment expects snake_case for iOS and camelCase for Android.

comScore SpecSegment Video Spec
notifyPlayVideo Content Started
notifyPlayWithPositionVideo Content Playing
notifyEndVideo Content Completed

If the properties.position is passed in, Segment calls the above methods with the play position.

Content properties (labels)

comScore LabelSegment Property
ns_st_ciasset_id
ns_st_pnpod_id
ns_st_eptitle
ns_st_snseason
ns_st_enepisode
ns_st_gegenre
ns_st_prprogram
ns_st_pupublisher
ns_st_stchannel
ns_st_cefull_episode

Note that iOS and Android expect different casing. Segment expects snake_case for iOS and camelCase for Android.

comScore SpecSegment Video Spec
notifyPlayVideo Ad Started
notifyPlayWithPositionVideo Ad Playing
notifyEndVideo Ad Completed
comScore LabelSegment Property
ns_st_amiasset_id
ns_st_adtype
ns_st_amttitle
ns_st_pupublisher
ns_st_cltotal_length

Note that iOS and Android expect different casing. Segment expects snake_case for iOS and camelCase for Android.


Additional video destination-specific options

additional-video-destination-specific-options page anchor

Example for Android:

1
Map<String, Object> comScoreOptions = new LinkedHashMap<>();
2
comScoreOptions.put("c3", "c3 value");
3
comScoreOptions.put("c4", "c4 value");
4
comScoreOptions.put("c6", "c6 value");
5
6
Analytics.with(context).track("Video Playback Started", new Properties(), new Options().setIntegrationOptions("comScore", comScoreOptions));

Video metrix dictionary classification

video-metrix-dictionary-classification page anchor

Represented with the labels c3, c4, c6, these labels determine which entity the clip will credit to in the Video Metrix dictionary. Segment allows you to pass values for these labels as a destination-specific option, since these values will.

These are required fields, so all three of these labels must always be passed. Unused labels must still be passed with the literal string value *null. These values should ONLY appear as part of the video destination, they should not appear or be set in the general mobile destination.

Only mapped on content events. ComScore has two definitions for Airdates: TV Airdate and Digital Airdate.This airdate helps comScore establish monetization windows (live, day +1, day +3, ...) for any given episode or show. The monetization windows are used to calculate commercial and program ratings. Each expects a value in yyyy-mm-dd format.

Segment allows you to pass in one or the other and map to comScore's labels for each.

tvAirdate : TV Airdate. The date on which the content aired on TV.

digitalAirdate : Digital Airdate. The date on which the content aired digitally.

Classification types are how comScore differentiates between an Ad and Content. Segment allows you to pass in a value for the classification type in two ways:

Ad classification type

ad-classification-type page anchor

You can pass in a value for adClassificationType as an integration specific option. Segment defaults to value va00 on all Ad related video tracking events. The values you may dynamically pass in are described by comScore below.

LINEAR - VIDEO ON DEMAND Linear advertisements delivered into a media player and presented before, in the middle of, or after video content is consumed by the user. The advertisement completely takes over the full view of the media player.

video + audio
Linear Pre-Rollva11
Linear Mid-Rollva12
Linear Post-Rollva13

LINEAR - LIVE Linear advertisements delivered before, in the middle of, or after a live stream of content. The advertisement completely takes over the full view of the media player.

video + audio
Linear Liveva21

BRANDED ENTERTAINMENT Media that a user may intentionally view (like content), or it may be served to a user during an ad break (like an advertisement).

video + audio
During Linear Pre-Rollva31
During Linear Mid-Rollva32
During Linear Post-Rollva33
As Contentva34
During Live Streamingva35

Content classification type

content-classification-type page anchor

You can pass in a value for contentClassificationType as a destination-specific option. Segment defaults to value vc00 on all Content related video tracking events. The values you may dynamically pass in are described by comScore below.

PREMIUM Content with strong brand equity or brand recognition. Premium content is usually created or produced by media and entertainment companies using professional-grade equipment, talent, and production crews that hold or maintain the rights for distribution and syndication.

video + audio
Short Form Video On Demandvc11
Long Form Video On Demandvc12
Live Streamingvc13

USER-GENERATED Content with little-to-no brand equity or brand recognition. User-generated content (UGC) has minimal production value, and is uploaded to the Internet by non-media professionals.

video + audio
Short Form Video On Demandvc21
Long Form Video On Demandvc22
Live Streamingvc23

BUMPERS Bumpers - also known as billboards or slates - are static promotional items which usually run before content and usually last less than 5 seconds.

video + audio
Bumpersvc99

How does comScore determine platform type?

how-does-comscore-determine-platform-type page anchor

The SDK auto-collects the internal device names, which comScore maps to their reportable Platforms seen broken out in your comScore Direct dashboard.

How does comScore determine unique devices?

how-does-comscore-determine-unique-devices page anchor

The comScore SDK will collect unique device id's under the hood, so based on this there is some filtering that can happen here. IN order to see a number for this metric, you need to select a Geography, Client ID, and Platform in the comScore dashboard. The All option will not produce a unique device.

How does comScore determine the application name?

how-does-comscore-determine-the-application-name page anchor

Used in the classification from comScore's Audience reporting, comScore retrieves the application name from your app's Info.plist application bundle name as returned by CFBundleName. If you want to override the automatically retrieved value, you can provide a string with your preferred app name.

How does comScore work with ProGuard?

how-does-comscore-work-with-proguard page anchor

If you are using minifyEnabled in your build, you would need to add the following to your proguard-project.txt file.

1
-keep class com.comscore.** { *; }
2
-dontwarn com.comscore.**

The comScore library uses static classes and the code is already optimized. These setting inform ProGuard to add the library as-is.