Injected events are fired automatically by code that is injected into your app through swizzling (in iOS) or by the Android Plugin (in Android). Injected events are the only events that are supported in library versions earlier than Android Library 3.0.0, iOS (Objective-C) Library 3.4.0, and iOS (Swift) Library 2.0.0.
To add an injected event:
- Open the app for which you would like to add an injected event.
- Click ADD EVENT.
- In the EVENT step, select Injected Event and enter the following:
- EVENT NAME - Used to identify the event in Ensighten Mobile.
- WHEN SHOULD THE EVENT FIRE? - Select when this event will fire:
- When a specific method runs – Fires when a specific method of a specific class runs.
- On Notification (IOS (OBJECTIVE-C) ONLY) – Fires when a specific notification is posted.
- When a Global Method runs (IOS (OBJECTIVE-C) ONLY) – Fires when a specific method of any class is called.
- On Interaction Trigger (IOS (OBJECTIVE-C) ONLY) – Fires when a user interacts with an element of a specific type.
- When application starts – Fires when the application is launched
- CLASS NAME – The name of the class to track. In Android, the full class name (including the package name) should be used.
- METHOD NAME – The name of the method to track. In iOS, the full method signature (including parameter names) should be used.
- USE FI (IOS ONLY) – In Objective-C, it is possible for a button click to fire an event twice. Selecting this option will prevent the second event from being fired.
- RUN ENSIGHTEN AFTER (IOS ONLY) – Collect the data at the end of the method rather than at the start. This allows you to access variables or data defined in the method body.
- Click NEXT.
- In the DATA step, add the data that you would like to collect. For more information, see Events - Creating Data Tokens.
- Click NEXT.
- In the TAGS step, add any tags that you would like to use. For more information, see Events - Tags.
- Click SAVE.
NOTE: It is recommended that you upgrade the Ensighten Mobile Library in your app to the latest version in order to use Lifecycle Events and Tracker Events. For more information, see Installation for Android, Installation for iOS (Swift) and Installation for iOS (Objective-C).