Advanced Configuration
Configuration Keys
This section details how to programmatically configure the Content Analytics extension.
The following config settings are available. These settings can also be managed within the Adobe Content Analytics extension.
All keys are prepended with contentanalytics..
You can configure the extension through the Data Collection Content Analytics extension UI, or programmatically.
Android
MobileCore.updateConfiguration(mapOf(
"contentanalytics.maxBatchSize" to 20,
"contentanalytics.batchFlushInterval" to 5000
))
iOS
MobileCore.updateConfigurationWith(configDict: [
"contentanalytics.maxBatchSize": 20,
"contentanalytics.batchFlushInterval": 5000
])
Datastream
You can stream data from content analytics through a separate datastream.
To route Content Analytics to a different datastream:
{
"edge.configId": "main-datastream-id",
"contentanalytics.configId": "content-analytics-datastream-id"
}
If contentanalytics.configId is not set, the default edge.configId is used.
Batching
You can use the following flush triggers:
- Batch reaches
maxBatchSize. - Timer reaches
batchFlushInterval(ms). - App backgrounds.
{
"contentanalytics.batchingEnabled": true,
"contentanalytics.maxBatchSize": 10,
"contentanalytics.batchFlushInterval": 2000
}
To disable flushes for immediate sends:
{ "contentanalytics.batchingEnabled": false }
data-variant=info
data-slots=text
Filtering
You filter content analytics events through regular expressions.
By URL
An example of a regex that filters out URLs.
{ "contentanalytics.excludedAssetUrlsRegexp": ".*\\.gif$|.*spinner.*" }
By Location
An example of a regex that filers our asset and experience locations.
{ "contentanalytics.excludedAssetLocationsRegexp": "^(debug|test).*" }
{ "contentanalytics.excludedExperienceLocationsRegexp": "^admin\\..*" }
Privacy
To manage privacy, use the consent API's.
Edge Consent
Android
// Opt in
Consent.update(mapOf("consents" to mapOf("collect" to mapOf("val" to "y"))))
// Opt out
Consent.update(mapOf("consents" to mapOf("collect" to mapOf("val" to "n"))))
// Pending
Consent.update(mapOf("consents" to mapOf("collect" to mapOf("val" to "p"))))
iOS
// Opt in
Consent.update(with: ["consents": ["collect": ["val": "y"]]])
// Opt out
Consent.update(with: ["consents": ["collect": ["val": "n"]]])
// Pending
Consent.update(with: ["consents": ["collect": ["val": "p"]]])
"y""n""p"Legacy
The legacy privacy APIs also should work.
Android
MobileCore.setPrivacyStatus(MobilePrivacyStatus.OPT_IN) // send
MobileCore.setPrivacyStatus(MobilePrivacyStatus.OPT_OUT) // drop + clear
MobileCore.setPrivacyStatus(MobilePrivacyStatus.UNKNOWN) // queue
iOS
MobileCore.setPrivacyStatus(.optedIn) // send
MobileCore.setPrivacyStatus(.optedOut) // drop + clear
MobileCore.setPrivacyStatus(.unknown) // queue
Data Deletion
To delete data, use resetIdentities() to reset identities, clear cache and queue.
Android
MobileCore.resetIdentities() // clears cache + queue
iOS
MobileCore.resetIdentities() // clears cache + queue
Featurization
Featurization is configured automatically. Sends experience content to the machine learning service for feature extraction.
See below for an example of the payload to send.
{
"experienceId": "mobile-abc123",
"orgID": "YOUR_ORG@AdobeOrg",
"content": {
"images": [{"value": "https://...jpg", "style": {}}],
"texts": [{"value": "Title", "style": {"role": "headline"}}],
"ctas": [{"value": "Buy", "style": {"enabled": true}}]
}
}
Tuning Batch Settings
The default settings (maxBatchSize: 10, batchFlushInterval: 2000 ms) should work well for most apps. Adjust these settings based on your event volume:
Trade-off: Larger batches reduce network overhead but increase latency before data appears in reporting.
Debugging
Use setLogLevel() to set the debugging level.
Android
MobileCore.setLogLevel(LoggingMode.VERBOSE)
iOS
MobileCore.setLogLevel(.debug)
Log entries are tagged. See below for the various tags.
[ContentAnalytics]- main[ContentAnalytics.Batch]- batching[ContentAnalytics.Featurization]- ML service