Edit in GitHubLog an issue

Adobe Content Analytics API reference

This section details the publicly available API's for Content Analytics.

registerExperience

Registers an experience and return an ID to track the experience.

Java

Syntax

Copied to your clipboard
static String registerExperience(List<ContentItem> assets, List<ContentItem> texts)
static String registerExperience(List<ContentItem> assets, List<ContentItem> texts, List<ContentItem> ctas)

Example

Copied to your clipboard
String expId = ContentAnalytics.registerExperience(
List.of(
new ContentItem("https://example.com/product.jpg")
),
List.of(
new ContentItem("iPhone 16 Pro", Map.of("role", "headline")),
new ContentItem("$999", Map.of("role", "price"))
),
List.of(
new ContentItem("Buy Now", Map.of("enabled", true))
)
);
ContentAnalytics.trackExperienceView(expId, "product.detail")

Kotlin

Syntax

Copied to your clipboard
fun registerExperience(
assets: List<ContentItem>,
texts: List<ContentItem>,
ctas: List<ContentItem>? = null
): String

Example

Copied to your clipboard
// Using InteractionType enum directly
val expId = ContentAnalytics.registerExperience(
assets = listOf(
ContentItem("https://example.com/product.jpg")
),
texts = listOf(
ContentItem("iPhone 16 Pro", mapOf("role" to "headline")),
ContentItem("$999", mapOf("role" to "price"))
),
ctas = listOf(
ContentItem("Buy Now", mapOf("enabled" to true))
)
);
ContentAnalytics.trackExperienceView(experienceId: expId, experienceLocation: "product.detail")

trackAsset

Tracks an asset with an explicit defined interaction type.

Java

Syntax

Copied to your clipboard
static void trackAsset(String assetURL)
static void trackAsset(String assetURL, InteractionType interactionType)
static void trackAsset(String assetURL, InteractionType interactionType, String assetLocation)
static void trackAsset(String assetURL, InteractionType interactionType, String assetLocation, Map<String, Object> additionalData)

Example

Copied to your clipboard
// Using InteractionType enum directly
ContentAnalytics.trackAsset(
"https://example.com/image.jpg",
InteractionType.VIEW,
"home"
);

Kotlin

Syntax

Copied to your clipboard
fun trackAsset(
assetURL: String,
interactionType: InteractionType = InteractionType.VIEW,
assetLocation: String? = null,
additionalData: Map<String, Any>? = null
): Unit

Example

Copied to your clipboard
// Using InteractionType enum directly
ContentAnalytics.trackAsset(
assetURL: "https://example.com/image.jpg",
interactionType: InteractionType.VIEW,
assetLocation: "home"
);

trackAssetClick

Convenience method for tracking asset clicks.

Java

Syntax

Copied to your clipboard
static void trackAssetClick(String assetURL)
static void trackAssetClick(String assetURL, String assetLocation)
static void trackAssetClick(String assetURL, String assetLocation, Map<String, Object> additionalData)

Example

Copied to your clipboard
// Using InteractionType enum directly
ContentAnalytics.trackAssetClick(
"https://example.com/image.jpg",
"home",
null
);

Kotlin

Syntax

Copied to your clipboard
fun trackAssetClick(
assetURL: String,
assetLocation: String? = null,
additionalData: Map<String, Any>? = null
): Unit

Example

Copied to your clipboard
// Using InteractionType enum directly
ContentAnalytics.trackAssetClick(
"https://example.com/image.jpg",
"home",
null
);

trackAssetCollection

Tracks multiple assets with the same interaction type.

Java

Syntax

Copied to your clipboard
static void trackAssetCollection(List<String> assetURLs)
static void trackAssetCollection(List<String> assetURLs, InteractionType interactionType)
static void trackAssetCollection(List<String> assetURLs, InteractionType interactionType, String assetLocation)

Example

Copied to your clipboard
ContentAnalytics.trackAssetCollection(
List.of(
"https://example.com/img1.jpg",
"https://example.com/img2.jpg"
),
"product-carousel"
);

Kotlin

Syntax

Copied to your clipboard
fun trackAssetCollection(
assetURLs: List<String>,
interactionType: InteractionType = InteractionType.VIEW,
assetLocation: String? = null
): Unit

Example

Copied to your clipboard
ContentAnalytics.trackAssetCollection(
assetURLs = listOf(
"https://example.com/img1.jpg",
"https://example.com/img2.jpg"
),
assetLocation = "product-carousel"
);

trackAssetView

Convenience method for tracking asset views.

Java

Syntax

Copied to your clipboard
static void trackAssetView(String assetURL)
static void trackAssetView(String assetURL, String assetLocation)
static void trackAssetView(String assetURL, String assetLocation, Map<String, Object> additionalData)additionalData)

Example

Copied to your clipboard
// Using InteractionType enum directly
ContentAnalytics.trackAssetView(
"https://example.com/image.jpg",
"home"
);

Kotlin

Syntax

Copied to your clipboard
fun trackAssetView(
assetURL: String,
assetLocation: String? = null,
additionalData: Map<String, Any>? = null
): Unit

Example

Copied to your clipboard
// Using InteractionType enum directly
ContentAnalytics.trackAssetView(
assetURL: "https://example.com/image.jpg",
assetLocation: "home"
);

trackExperienceClick

Tracks when an experience is clicked.

Java

Syntax

Copied to your clipboard
static void trackExperienceClick(String experienceId)
static void trackExperienceClick(String experienceId, String experienceLocation)
static void trackExperienceClick(String experienceId, String experienceLocation, Map<String, Object> additionalData)

Example

Copied to your clipboard
ContentAnalytics.trackExperienceClick(
expId,
"homepage.hero",
Map.of("viewDuration", 5.2)
);

Kotlin

Syntax

Copied to your clipboard
fun trackExperienceClick(
experienceId: String,
experienceLocation: String? = null,
additionalData: Map<String, Any>? = null
): Unit

Example

Copied to your clipboard
// Using InteractionType enum directly
ContentAnalytics.trackExperienceClick(
experienceId: expId,
experienceLocation: "homepage.hero",
additionalData: ["viewDuration": 5.2]
)

trackExperienceView

Tracks when an experience is viewed.

Java

Syntax

Copied to your clipboard
static void trackExperienceView(String experienceId)
static void trackExperienceView(String experienceId, String experienceLocation)
static void trackExperienceView(String experienceId, String experienceLocation, Map<String, Object> additionalData)

Example

Copied to your clipboard
ContentAnalytics.trackExperienceView(
expId,
"homepage.hero",
Map.of("viewDuration", 5.2)
);

Kotlin

Syntax

Copied to your clipboard
fun trackExperienceView(
experienceId: String,
experienceLocation: String? = null,
additionalData: Map<String, Any>? = null
): Unit

Example

Copied to your clipboard
// Using InteractionType enum directly
ContentAnalytics.trackExperienceView(
experienceId: expId,
experienceLocation: "homepage.hero",
additionalData: ["viewDuration": 5.2]
)

Data types

contentItem

Represents the content within an experience (assets, texts, CTAs).

Java

Syntax

Copied to your clipboard
public class ContentItem {
private final String value;
private final Map<String, Object> styles;
public ContentItem(String value, Map<String, Object> styles) {
this.value = value;
this.styles = styles;
}
// Convenience constructor to mirror the default parameter
public ContentItem(String value) {
this(value, Collections.emptyMap());
}
public String getValue() {
return value;
}
public Map<String, Object> getStyles() {
return styles;
}
public Map<String, Object> toMap() {
Map<String, Object> map = new HashMap<>();
map.put("value", value);
map.put("styles", styles);
return map;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ContentItem)) return false;
ContentItem that = (ContentItem) o;
return Objects.equals(value, that.value) &&
Objects.equals(styles, that.styles);
}
@Override
public int hashCode() {
return Objects.hash(value, styles);
}
@Override
public String toString() {
return "ContentItem{value='" + value + "', styles=" + styles + "}";
}
}

Example

Copied to your clipboard
// Asset with URL
ContentItem("https://example.com/hero.jpg")
// Text with role
ContentItem("Welcome!", mapOf("role" to "headline"))
// CTA with enabled state
ContentItem("Shop Now", mapOf("enabled" to true, "role" to "primary"))

Kotlin

Syntax

Copied to your clipboard
data class ContentItem(
val value: String,
val styles: Map<String, Any> = emptyMap()
) {
fun toMap(): Map<String, Any>
}

Example

Copied to your clipboard
// Asset with URL
ContentItem(value: "https://example.com/hero.jpg")
// Text with role
ContentItem(value: "Welcome!", styles: mapOf("role" to "headline"))
// CTA with enabled state
ContentItem(value: "Shop Now", styles: mapOf("enabled" to true, "role" to "primary"))

interactionType

Defines the type of interaction, either a view or a click.

Java

Syntax

Copied to your clipboard
public enum InteractionType {
VIEW,
CLICK,
DEFINITION;
public String getStringValue() {
return name().toLowerCase();
}
}

Example

Copied to your clipboard
ContentAnalytics.trackAsset(
"https://example.com/hero.jpg",
InteractionType.VIEW
)

Kotlin

Syntax

Copied to your clipboard
enum class InteractionType {
VIEW,
CLICK,
DEFINITION;
val stringValue: String
get() = name.lowercase()
}

Example

Copied to your clipboard
ContentAnalytics.trackAsset(
assetURL = "https://example.com/hero.jpg",
interactionType = InteractionType.VIEW
)

Configuration

The following config settings are available. These settings can also be managed within the Adobe Content Analytics extension.

SettingTypeDefaultDescription
configId
String
N/A
batchingEnabled
Boolean
true
maxBatchSize
Integer
10
flushInterval
Integer
2000
trackExperiences
Boolean
true
excludedAssetLocationsRegexp
String
-
excludedAssetUrlsRegexp
String
-
excludedExperienceLocationsRegexp
String
-
debugLogging
Boolean
false
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2026 Adobe. All rights reserved.