For the complete documentation index, see llms.txt.

Use Adobe Analytics

Last updated View as Markdown

This SDK mainly receives critical fixes. New capabilities are shipping in the CSQ SDK first.

Migrate to the CSQ SDK using our AI wizard.

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, Session Replay).

Adobe SDK code requirements

Make sure you register at least Identity.EXTENSION and Analytics.EXTENSION extensions before starting MobileCore. Check the Getting Started with Adobe Analytics Android Extension ↗ repository for that.

  1. Follow the instructions from Adobe Analytics for mobile apps ↗
  2. Add the AEP Android 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));
}
}