Skip to content

Commit

Permalink
Add user consent documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
StaehliJ committed Nov 29, 2023
1 parent 7b9169e commit 3ac7b9c
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion pillarbox-analytics/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,35 @@ class DemoApplication : Application() {
}
```

### Handle user consent
User consent can be configured at initialization:

```kotlin
val initialUserConsent = UserConsent(
comScore = ComScoreUserConsent.UNKNOWN,
commandersActConsentServices = emptyList()
)

val config = AnalyticsConfig(
vendor = AnalyticsConfig.Vendor.SRG,
nonLocalizedApplicationName = "PillarboxDemo",
appSiteName = "pillarbox-demo-android",
sourceKey = AnalyticsConfig.SOURCE_KEY_SRG_DEBUG,
userConsent = initialUserConsent
)

initSRGAnalytics(config = config)
```
Update user consent at runtime:
```kotlin
val updatedUserConsent = UserConsent(
comScore = ComScoreUserConsent.DECLINED, //or ComScoreUserConsent.ACCEPTED
commandersActConsentServices = listOf("service1_id", "service2_id")
)
SRGAnalytics.setUserConsent(updatedUserConsent)
```
User consent values are updated at the next analytics event.

### Send page view

To send a page view use `SRGAnalytics.sendPageView`. It will trigger a CommandersActs and a Comscore page view event directly.
Expand All @@ -54,7 +83,6 @@ In the case of a multi pane view each pane view can send a page view. It is usef

For Android Auto application it is not recommended to send page view.


### Send event

Events are application event the analytics team of the application want to track. It could be click event, user choice etc..
Expand Down

0 comments on commit 3ac7b9c

Please sign in to comment.