Enable product view signals in an Android app
The product view signal captures when a user views a product detail screen — for example, a product detail page or bottom sheet in retail, an itinerary or room view in travel, or a specific policy or account page in financial services. It helps your marketing team understand which products receive the most attention and enables segmentation by product and product category in Connect.
Availability: Premium and Ultimate
Languages: Kotlin and Java
Implementation considerations
When to fire the signal
Fire the product view signal each time a product detail screen or bottom sheet loads. Use productView instead of pageView on product detail screens — productView carries the richer schema and is the semantically correct signal type for this context.
If your app shows multiple products simultaneously — for example, a shortlist of hotel rooms — fire one signal per product.
Product catalog
The product view signal automatically updates your product catalog in Connect:
- If the product ID is new, Connect creates a catalog entry from the signal data.
- If the product ID already exists, Connect updates the following catalog attributes from the signal:
productName,unitPrice,productCategory,productDescription,currency,discount,availability,brandName,imageUrls,inventoryQuantity,model,msrp,productRating,productStatus,productUrls, andsku. - Connect matches categories by the
productCategorystring — if a category with that name already exists, the signal maps to it; if it's new, Connect creates a catalog category entry and assigns it an internal ID.
Null values do not overwrite existing catalog data. Empty strings update the field to blank. Zero values update numeric fields to zero.
Relationship to the product configuration signal
The product view and product configuration signals work together:
productView— captures the product itself when the screen loadsproductConfiguration— captures user interactions on the product screen, such as selecting a color or size
Contact mapping
Use the audience field to map the signal to a contact in Connect. Commonly used identifiers are email address, phone number, and customer ID.
NoteA customer ID mapped to the Contact key attribute in Connect is the most reliable identifier for known contacts. However, if no matching contact exists and the only attribute is a contact key, the signal is discarded — contact keys alone cannot create new contacts.
Sources of the identifier in an Android app:
- In-memory session object (for example,
UserSession.email) SharedPreferencesfor persisted login state- Room database or other local store
The value must be a JSONObject where each key is a contact attribute name as it appears in Connect (including capitalization and spacing) and each value is the attribute value. For phone number attributes, use the E.164 format: +[country code][area code][phone number] — no spaces, dashes, or special characters. If the + symbol is omitted, Connect adds it automatically.
NoteWe recommend attaching identifiers to as many signals as possible. If the user is not authenticated, omit
audience— Connect will attempt to identify the visitor using other signals from the same session.
Configuration
Method
Connect.logSignal(data: HashMap<String?, Any?>?): BooleanSends the signal to the Acoustic Connect endpoint. The Connect SDK must be initialized via Connect.enable() before calling this method.
Pass all fields as a flat HashMap. The SDK handles the signal structure automatically — you do not need to construct a nested object.
Signal fields
Required
| Field | Schema type | Description |
|---|---|---|
productId | String | Unique product identifier (may match SKU) |
productName | String | Name of the product |
signalType | String | Signal type. Value: "productView". |
Optional
| Field | Schema type | Description |
|---|---|---|
audience | JSONObject | Key-value pairs for contact mapping. Must be a flat JSONObject — not a HashMap. Keys must match contact attribute names exactly as they appear in Connect. |
availability | String | Availability status (for example, "In Stock", "Out of Stock", "Back Order") |
brandName | String | Brand name of the product |
category | String | Signal category. Value: "Behavior". |
currency | String | ISO 4217 currency code (for example, "USD", "EUR"). Defaults to the currency set for your Connect subscription. |
description | String | A description of the signal |
discount | Number | Discount amount or difference between original and current price. Pass as a string. |
effect | String | Describes the effect of the signal on engagement. Use "positive" for product views. |
imageUrls | JSONArray | URLs of product images. Pass as a JSONArray of strings. |
inventoryQuantity | Number | Number of units available. Pass as a string. |
model | String | Model number or description |
msrp | Number | Suggested retail price or original price. Pass as a string. |
name | String | A label to differentiate this signal from others (for example, "productView from Android app"). Max 256 characters |
productCategory | String | Product category from your catalog |
productDescription | String | Description of the product |
productRating | Number | Rating of the product. Pass as a string. |
productStatus | String | Current lifecycle state (for example, "Active", "Discontinued", "Upcoming") |
productUrls | JSONArray | URLs of product pages. Pass as a JSONArray of strings. |
promotionId | String | ID from a marketing campaign that led to this view |
shoppingCartUrl | String | URL or deep link to the shopping cart |
sku | String | SKU, if different from productId |
unitPrice | Number | Unit price of the product. Pass as a string. |
virtualCategory | String | Category based on navigation path (for example, "New arrivals", "Sale") |
Things to know
Fields with schema type Number must be passed as strings. The SDK serializer silently drops numeric values.
Pass
audienceas aJSONObject, not aHashMap. AHashMapvalue is silently dropped by the SDK serializer and the contact will not be mapped.Pass
imageUrlsandproductUrlsas aJSONArrayof strings.If a required field is missing or invalid, the entire signal is discarded. If a required field isn't applicable to your business, use a placeholder value.
Required imports
import org.json.JSONArray
import org.json.JSONObjectBasic example
val data = hashMapOf<String?, Any?>(
"signalType" to "productView",
"productId" to "SKU-12345",
"productName" to "Wireless Headphones"
)
Connect.logSignal(data)Complete example
This example fires a product view signal from a product detail bottom sheet when the screen loads. It includes pricing, category, and optional contact mapping.
import org.json.JSONObject
import com.acoustic.connect.android.connectmod.Connect
private fun sendProductViewSignal() {
// Fields with schema type Number must be passed as strings
val data = hashMapOf<String?, Any?>(
"signalType" to "productView",
"productId" to product.id,
"productName" to product.name,
"unitPrice" to product.price.toPlainString(),
"productCategory" to product.category.displayName,
"currency" to "USD",
"effect" to "positive"
)
// audience must be JSONObject — HashMap values are silently dropped
UserSession.email?.let { email ->
data["audience"] = JSONObject().put("Email Address", email)
}
Connect.logSignal(data)
}Call sendProductViewSignal() from onViewCreated(), after the product data is available.
Troubleshooting
Signal not appearing in Connect?
- Confirm
Connect.enable()is called beforelogSignal. - Check that
logSignalreturnstrue. Afalsereturn indicates the SDK rejected the call. - Verify the
appKeyandpostMessageUrlmatch the Connect org you're checking.
Signal marked as invalid in Connect?
- Confirm all required fields are present:
signalType,productId,productName. - Verify that Number fields are passed as strings — use
price.toPlainString().
Contact not created or updated?
- Confirm
audienceis aJSONObject, not aHashMap. - Verify attribute key names match exactly how they appear in Connect — including capitalization and spacing.
