Newer Version Available
Considerations for Custom Interactions
| Available in: both Salesforce Classic and Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, and Developer Editions |
As an ISV partner, the complex features that you develop in your managed packages could involve multiple actions on different objects, callouts to Apex functions, and much more. It can be difficult to interpret how your subscribers interacted with specific packaged components via your downloaded App Analytics package usage logs and summaries.
To provide you with more clarity about your subscribers’ events in custom ways and at different granularity levels, create custom interactions in your managed packages using Apex.
With Apex custom interactions, you can discover:
- Which app feature a user interacted with
- How users flowed through a specific user journey
- Which UI components a user interacted with
Keep these considerations in mind:
- A custom interaction can appear for a given user request up to 50 times. This limit avoids flooding the logs due to large loops.
- We recommend that you don’t call IsvPartners.AppAnalytics.logCustomInteraction from inside a loop.
- If the IsvPartners.AppAnalytics.logCustomInteraction method is called from a running Apex test, no AppExchange App Analytics package usage log or package usage summary data is produced.
Log Custom Interactions
- In your packaged Apex code, include Apex enums that are associated with the events that you want to log as custom interactions.
- In your Apex code, invoke IsvPartners.AppAnalytics.logCustomInteraction, using the enums that you created.
- Test your code by running it in your development environment and checking your debug logs to be certain that the custom interactions you created are being logged. Ensure that your debug log levels for Apex Code are set to FINE.
- After you’re finished with your implementation, publish a new version of your managed package.
- After subscribers install your package, retrieve your package usage logs and package usage summaries. Filter your package usage log data on custom_entity_type by CustomInteractionLabel, and on log_record_type by CustomInteraction. Or filter your package usage summary data on custom_entity_type by CustomInteractionLabel.
- Analyze your custom interaction data.
Example
Let’s suppose you have a Lightning Web Component (LWC). Your LWC provides a list of related contacts for each Account record, uses a table layout, and is wired to an Apex class. You add a new card layout to your LWC. To track how well users are adopting this new layout, you log an interaction when a user switches between layouts.

In your code, include Apex enums and invoke IsvPartners.AppAnalytics.logCustomInteraction.
Your LWC HTML code:
Your LWC JavaScript code:
Your Apex class:
Next, you test your code. With your Apex code debug log level set to FINE, confirm that the custom interactions are logged by finding events in your debug logs called APP_ANALYTICS_FINE, APP_ANALYTICS_WARN, or APP_ANALYTICS_ERROR.