Skip to content

Commit

Permalink
Clarify that user consent initialisation should be done in the `Appli…
Browse files Browse the repository at this point in the history
…cation` class
  • Loading branch information
MGaetan89 authored Nov 30, 2023
1 parent d93ca74 commit c8df3e1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pillarbox-analytics/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class DemoApplication : Application() {
```

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

User consent can be configured at initialization, from your `Application` class:
```kotlin
val initialUserConsent = UserConsent(
comScore = ComScoreUserConsent.UNKNOWN,
Expand All @@ -59,14 +59,17 @@ val config = AnalyticsConfig(

initSRGAnalytics(config = config)
```
Update user consent at runtime:

Or it can be updated at any time using the following code snippet:
```kotlin
val updatedUserConsent = UserConsent(
comScore = ComScoreUserConsent.DECLINED, //or ComScoreUserConsent.ACCEPTED
comScore = ComScoreUserConsent.DECLINED, // or ComScoreUserConsent.ACCEPTED
commandersActConsentServices = listOf("service1_id", "service2_id")
)

SRGAnalytics.setUserConsent(updatedUserConsent)
```

User consent values will be updated with the next analytics event.

### Send page view
Expand Down

0 comments on commit c8df3e1

Please sign in to comment.