Use Adobe Analytics

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).

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.

  1. Follow the instructions from Adobe Analytics for mobile apps
  2. Add the AEPAnalytics iOS SDK to your project

Add the CSAppLifecycleObserver to the ProcessLifecycleOwner

public class CSAppLifecycleObserver implements DefaultLifecycleObserver {
private final SharedPreferences sharedPreferences;
private final Random random = new Random();
public CSAppLifecycleObserver(@NonNull Context appContext) {
sharedPreferences = appContext.getSharedPreferences(
"CSAppLifecycleObserver",
MODE_PRIVATE
);
}
@Override
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) {
return;
}
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));
}
}