Skip to content

Commit

Permalink
Update documentation in ch.srgssr.pillarbox.analytics.comscore
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Oct 29, 2024
1 parent 5633263 commit 7e57b95
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,44 @@
package ch.srgssr.pillarbox.analytics.comscore

/**
* ComScore
* Interface for interacting with the ComScore SDK.
*
* @constructor Create empty Com score
* This interface provides methods for sending page view to ComScore. It also allows for managing permanent data and user consent.
*/
interface ComScore {
/**
* Send page view to ComScore
* @param pageView The [ComScorePageView] to send.
* Sends a page view event to ComScore.
*
* @param pageView The [ComScorePageView] object containing the data for the page view to be sent.
*/
fun sendPageView(pageView: ComScorePageView)

/**
* Put persistent labels
* Puts the provided labels.
*
* @param labels The values to put.
* @param labels A map containing the labels.
*/
fun putPersistentLabels(labels: Map<String, String>)

/**
* Remove persistent label
* Removes a persistent label.
*
* @param label The label to remove.
*/
fun removePersistentLabel(label: String)

/**
* Get persistent label
* Retrieves the persistent value associated with the given label.
*
* @param label The label to get.
* @return null if not found.
* @param label The label used to identify the persistent value.
* @return The persistent value associated with the label, or `null` if not found.
*/
fun getPersistentLabel(label: String): String?

/**
* Set user consent
* Sets the user consent.
*
* @param userConsent
* @param userConsent The user consent level, represented by a [ComScoreUserConsent] enum entry.
*/
fun setUserConsent(userConsent: ComScoreUserConsent)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
package ch.srgssr.pillarbox.analytics.comscore

/**
* ComScore page view
* Represents a page view event for ComScore.
*
* @property name The name of the page view.
* @property labels The custom labels to send with this page view event. Blank values are not send.
* This class encapsulates the data required to track a page view event, including the page name and custom labels.
*
* @property name The name of the page being viewed. This property cannot be blank.
* @property labels A map of custom labels to be associated with the page view event. Blank values are ignored and not sent. Defaults to an empty map.
*
* @throws IllegalArgumentException If [name] is blank.
*/
data class ComScorePageView(
val name: String,
Expand All @@ -19,7 +23,9 @@ data class ComScorePageView(
}

/**
* Labels as a Map usable by ComScore.
* Converts this object's properties into a [Map] of labels suitable for ComScore.
*
* @return A [Map] containing the labels, ready to be used by ComScore.
*/
fun toLabels(): Map<String, String> {
val labels = HashMap<String, String>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,22 @@
package ch.srgssr.pillarbox.analytics.comscore

/**
* Com score user consent
* Represents the user consent status for ComScore.
*/
enum class ComScoreUserConsent {
/**
* Unknown
*
* User has not taken an action.
* Represents a status that is unknown or has not yet been determined. This typically serves as a default or initial state before an action is
* taken.
*/
UNKNOWN,

/**
* Accepted
*
* User has given consent.
* Indicates that the user has explicitly given consent.
*/
ACCEPTED,

/**
* Declined
*
* User has not given consent or has opted out.
* Indicates that the user has explicitly declined the request or opted out.
*/
DECLINED,
}

0 comments on commit 7e57b95

Please sign in to comment.