This article provides an overview of the technicalities of Pendo mobile tagging. Mobile analytics identification differs from web analytics identification in two ways:
- Analytics for mobile Pages relies on tracking user navigation between different screens within an app rather than URLs.
- Analytics for mobile Features uses tracking of specific user interactions, such as button taps, swipe gestures, and other in-app actions rather than CSS rules.
How does the Pendo SDK work?
- The SDK automatically collects and reports Page views, Feature clicks, time on Page, time on app, and so on.
- The SDK detects UI changes: scrolling, clicks, and changes in the View hierarchy of the visible screen.
- Each time the SDK detects a new Page or button, it checks whether there's a guide that might be activated on that Page or button.
Page identification
Mobile Pages in Android and iOS applications are identified by both default rules, and optional rules that users can add.
Default rules
- In Android apps, Pendo identifies a Page by the visible fragments and the current activity hosting them, and the hierarchy between them.
- In iOS apps, Pendo identifies a Page by the comprising UIViewControllers and their hierarchy.
- Additional hints like the index of a selected tab and text (in TabLayouts), selected Page (ViewPager), and selected title (BottomNavigationView) are also used.
Optional rules
-
Users can assign a UI label as a custom identifier to a Page to distinguish between Pages with a similar structure. This can be done by users in the Page Rules tab in Manage Page. To achieve this, Pendo uses Page texts (fully hashed). This can be turned off but might hamper the Page identification.
Tip: Try adding custom identifiers to the Page when it has the same analytics data as a different Page (if you're seeing the same number of Page views/visitors/accounts).
- If the Page has a title, the title is included in the Page rule by default and can be removed by the end-user in the 'Page rules' tab of this Page.
Tip: Try removing the title when you're seeing too little data for that Page.
Feature identification
- Pendo identifies any element that has a click handler or gesture as clickable.
- Pendo uses many pieces of data to identify Features, such as text, accessibility, class name, action, index in the list, or index in the parent.
- A default Feature rule is created using this information.
- Use the advanced settings in the Feature rules to manually alter the rules. For more information, see Advanced settings for mobile Feature tagging.
If the Page or Feature rules are still not specific enough and you need help fine-tuning them to your needs, contact Pendo Support.
Set up a code-based solution for mobile tagging
Our code-based solution offers additional ways to identify user interactions in your apps as an alternative for when Features can't be tagged.These include using APIs to mark a specific element in your user interface as clickable, or using Track Events.
For more information about using Track Events, see Mobile Track Events example.
After Features have been tagged by the developers using the code-based solution, you need to update or capture the Page using the app version containing these changes.
Use API code-based solution
The examples below are for developers to use API code-based solution to mark elements in the interface as clickable.
For native applications:
-
For iOS. iOS updates how the SDK perceives the element. Call
pendoRecognizeClickAnalytics
on the UIView (for UIKit) or the View (for SwiftUI) after you create that view or when you have access to it when the Page loads. This forces the SDK to identify the element as clickable for tagging, and the SDK also automatically collects any clicks on it. For more information, see UIView and View APIs. -
For Android. You must set the element to be clickable and manually send the click events in the click logic. Call the
sendClickAnalytics
API, passing in the relevant view from the click action, such as onTouchListener or onClickListener. For more information, see native Android APIs documentation in the Github site.
For React Native applications:
- To mark any element as clickable, the “nativeID“ property is used.
<Image nativeID="pendoClickableImage" source={require('../../../assets/icons/react_native.png')} style={{resizeMode: 'contain', width: 100, height: 100, alignSelf: 'center'}} onTouchEnd={()=> { Alert.alert("Wohoo I love react native");}} />
- The nativeID must match the Regex template. The default is
pendoClickable
as a prefix for nativeID and doesn't require any setup. For any other Regex template, if the customer has already defined nativeID's, the developer must configures Regex as follows:
- For React Navigation lib through
traversalOptionsObject.clickableElementsNativeIDsRegex
:
- For React Navigation lib through
let traversalOptionsObject: RNTraverseOptions = {clickableElementsNativeIDsRegex: '^clickable|^pendo_|...'};
export default withPendoRN(RootNavigator, traversalOptionsObject);
-
- For React Native Navigation lib through
navigationOptions.clickableElementsNativeIDsRegex
:
- For React Native Navigation lib through
const navigationOptions = {library: NavigationLibraryType.ReactNativeNavigation, navigation: Navigation, clickableElementsNativeIDsRegex: '^clickable|^pendo_|customRegex'};
PendoSDK.setup(pendoKey, navigationOptions, options);
-
If a customer configures Regex on their own, they must make sure that all Regex templates are included in the default template and include
'pendoClickable'
, specificallyclickableElementsNativeIDsRegex: '^clickable|^pendoClickable|customRegex'
-
For React Native Android only. If the click analytics aren't generated after marking the element, call the
sendClickAnalytics
API and pass the nativeID as a parameter. Our native SDK then finds this view in a layout hierarchy to gather element information and send its analytics.
onTouchEnd={()=> { Alert.alert("Wohoo I love react native"); PendoSDK.sendClickAnalytic("pendoClickableImage") }
Note: Analytics aren't retroactive when using the API. Data is collected only after using this API, which is similar behavior to a Track Event.
For more information about the sendClickAnalytics
API, see the API documentation in the Github site.