Custom Interactions

To understand which features and UI components a subscriber interacted with and how they flow through a user journey, create custom interactions with Apex enums and the IsvPartners.AppAnalytics.logCustomInteraction Apex method.
Available in: both Salesforce Classic and Lightning Experience
Available in: Enterprise, Performance, Unlimited, and Developer Editions

Standard Data Supplemental Data
  • class_name
  • method_name
  • line_number
  • interaction_id_token
api_version

Successful Custom Interactions

To analyze a custom interaction with your packaged components, look for a log_record_type of CustomInteraction and a custom_entity_type of CustomInteractionLabel. The custom_entity contains a custom interaction label that you created and that was logged.

interaction_id_token is included only if an interaction_id was provided to the associated IsvPartners.AppAnalytics.logCustomInteraction call. interaction_id_token is a hashed, tokenized version of the raw interaction id that was provided.

Note

Unsuccessful Custom Interactions

When custom_entity_type is equal to CustomInteractionFailure then the custom interaction couldn’t be logged. To determine the reason for the failed logging, review the reason code provided by the custom_entity value.

custom_entity Message
LABEL_NO_NAMESPACE We couldn’t log the custom interaction with App Analytics. The interaction label provided to IsvPartners.AppAnalytics.logCustomInteraction must have a namespace.
LABEL_NOT_ENUM We couldn’t log the custom interaction with App Analytics. The interaction label provided to IsvPartners.AppAnalytics.logCustomInteraction must be an Apex enum.
LABEL_WRONG_NAMESPACE We couldn’t log the custom interaction with App Analytics. The interaction label provided to IsvPartners.AppAnalytics.logCustomInteraction must have the same namespace as the Apex code that called the method.
OVER_CALL_LIMIT IsvPartners.AppAnalytics.logCustomInteraction was called too many times in a single user request. This custom interaction and subsequent ones for this user request weren’t logged with App Analytics.

Example

Let’s look at an example package usage log record and analyze a successful Apex interaction.

{
    "timestamp_derived": "2023-09-20T06:17:39.167Z",
    "log_record_type": "CustomInteraction",
    "request_id": "TID:7635077000004b3035",
    "organization_id": "00Dxx0000006H2l",
    "organization_name": "MyCustomer Inc.",
    "organization_status": "Demo",
    "organization_edition": "Enterprise Edition",
    "organization_country_code": "IN",
    "organization_language_locale": "en_US",
    "organization_time_zone": "Australia/Sydney",
    "organization_instance": "GS0",
    "organization_type": "Production",
    "user_id_token": "005-9BwnBWYO5FMn4cZ1sLw7F3LmTpoe8M77GrZOZHL6xQk=",
    "user_type": "Standard",
    "package_id": "033xx0000004FqD",
    "package_version_id": "04txx0000004Idi",
    "managed_package_namespace": "Acme",
    "custom_entity": "MyInteractionLabels.LoginButtonClicked",
    "custom_entity_type": "CustomInteractionLabel",
    "session_key": "2l4YtFB/RmsRKVsS",
    "login_key": "fGV6RgVOH3ZCgl2v",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/IP_ADDRESS_REMOVED Safari/537.36",
    "user_country_code": "US",
    "user_time_zone": "America/Los_Angeles",
    "class_name": "Acme.MyController",
    "method_name": "loginButtonCallback",
    "line_number": 56,
    "interaction_id_token": "7NDe8HM8ZgPdBL+jiOpTW3/xKTwwL30dyxmKNxtyzi8="
}

The MyInteractionLabels.LoginButtonClicked custom interaction label was logged as a custom interaction as a result of a user action from subscriber org MyCustomer Inc on 2023-09-20 at 6:17 am. Specifically, the user interaction resulted in logging a custom interaction from line number 56 of the loginButtonCallback method found in the Acme.MyController Apex class. In addition to the InteractionLabels.LoginButtonClicked label, an interaction ID was provided to the log call resulting in an interaction token id value of 7NDe8HM8ZgPdBL+jiOpTW3/xKTwwL30dyxmKNxtyzi8=.

The key data in this analysis are:

Question Field Value
What
  • class_name
  • custom_entity
  • custom_entity_type
  • package_version_id
  • managed_package_namespace
  • class_name
  • method_name
  • line_number
  • interaction_id_token
  • Acme.MyController
  • MyInteractionLabels.LoginButtonClicked
  • CustomInteractionLabel
  • 04txx0000004Idi
  • Acme
  • loginButtonCallback
  • 56
  • 7NDe8HM8ZgPdBL+jiOpTW3/xKTwwL30dyxmKNxtyzi8=
Who
  • organization_id
  • user_id_token
  • 00Dxx0000006H2l
  • 005-9BwnBWYO5FMn4cZ1sLw7F3LmTpoe8M77GrZOZHL6xQk=
How log_record_type CustomInteraction
When timestamp_derived 2023-09-20T06:17:39.167Z