A newer version of this documentation is available. Switch to the
latest version
docs.
Analyze your data from anywhere in the customer journey using your Adobe Analytics segments.
Contentsquare allows you to use your Adobe Analytics segments in every Contentsquare feature (Journey Analysis, Page Comparator, Zoning Analysis, Session Replay).
Warning
Sessions without at least one screenview will be discarded.
You should implement your screen tracking plan first, to have your Adobe Analytics integration work.
See Track screens .
Adobe SDK code requirements
Make sure you register at least Identity.EXTENSION
and Analytics.EXTENSION
extensions before starting MobileCore
.
Check the Adobe iOS AEPAnalytics SDK repository for that.
Follow the instructions from Adobe Analytics for mobile apps
Add the AEPAnalytics iOS SDK to your project
Add the CSAppLifecycleObserver to the ProcessLifecycleOwner
Note
Why 30 minutes before sending a new csMatchingKey
30 minutes is Contentsquare default session duration.
Setting a value higher than 30 minutes would cause overlapping on our sessions, and would impact negatively the data import from Adobe.
Setting a value lower than 30 minutes would make you to send more data to Adobe.
This could cause the variable to reach Adobe’s threshold, causing Adobe to filter values, and potentially impact your billing.
See Low-traffic value in Adobe Analytics
public class CSAppLifecycleObserver implements DefaultLifecycleObserver {
private final SharedPreferences sharedPreferences ;
private final Random random = new Random () ;
public CSAppLifecycleObserver ( @ NonNull Context appContext) {
sharedPreferences = appContext . getSharedPreferences (
"CSAppLifecycleObserver" ,
public void onResume ( @ NonNull LifecycleOwner owner) {
DefaultLifecycleObserver . super . onResume (owner) ;
sendCSMatchingKeyIfNeeded () ;
public void sendCSMatchingKeyIfNeeded () {
String csMatchingKeyTimestampKey = "csMatchingKey_ts" ;
int csMatchingKeyValidityMs = 1800000 ; // 30 minutes
long currentTimestamp = new Date () . getTime () ;
long csMatchingKeyIsPreviousTimestamp = sharedPreferences . getLong (csMatchingKeyTimestampKey , 0 ) ;
if (( currentTimestamp - csMatchingKeyIsPreviousTimestamp ) <= csMatchingKeyValidityMs ) {
sharedPreferences . edit () . putLong (csMatchingKeyTimestampKey , currentTimestamp) . apply () ;
String csMatchingKey = "csMatchingKey" ;
String csMatchingKeyValue = random . nextDouble () + "_" + currentTimestamp ;
Contentsquare . send (csMatchingKey , csMatchingKeyValue) ;
MobileCore . trackState (csMatchingKey + "_state" , Collections . singletonMap (csMatchingKey , csMatchingKeyValue)) ;
class CSAppLifecycleObserver (appContext: Context) : DefaultLifecycleObserver {
private val sharedPreferences = appContext. getSharedPreferences (
"CSAppLifecycleObserver" ,
private val random = Random ()
override fun onResume (owner: LifecycleOwner) {
sendCSMatchingKeyIfNeeded ()
private fun sendCSMatchingKeyIfNeeded () {
val csMatchingKeyTimestampKey = "csMatchingKey_ts"
val csMatchingKeyValidityMs = 1800000 // 30 minutes
val currentTimestamp = Date ().time
val csMatchingKeyIsPreviousTimestamp = sharedPreferences. getLong (csMatchingKeyTimestampKey, 0 )
if (currentTimestamp - csMatchingKeyIsPreviousTimestamp <= csMatchingKeyValidityMs) {
sharedPreferences. edit (). putLong (csMatchingKeyTimestampKey, currentTimestamp). apply ()
val csMatchingKey = "csMatchingKey"
val csMatchingKeyValue = random. nextDouble (). toString () + "_" + currentTimestamp
Contentsquare. send (csMatchingKey, csMatchingKeyValue)
MobileCore. trackState ( " ${ csMatchingKey } _state" , Collections. singletonMap (csMatchingKey, csMatchingKeyValue))