Track From App
CartEvent#
There events indicate user interactions with cart
- Add product to cart
- Android
- iOS
- Remove product from cart
- Android
- iOS
- Increase quantity product
- Track when press
+button to quickly increase quantity in cart - According constant
CartEventIdentifier.CartEventName.IncreaseQuantityProduct
- Decrease quantity product
- Track when press
-button to quickly decrease quantity in cart - According constant
CartEventIdentifier.CartEventName.DecreaseQuantityProduct
- Select product
- Track when user tick checkbox to mark product as selected for checkout in cart
- According constant
CartEventIdentifier.CartEventName.SelectProduct
- Deselect product
- Track when user un-tick checkbox to mark product as not selected for checkout in cart
- According constant
CartEventIdentifier.CartEventName.UnSelectProduct
- Revert product
- Track when user revert the "remove product from cart" action
- According constant
CartEventIdentifier.CartEventName.RevertProductToCart
ScreenViewEvent#
There events indicate user view/exit a screen in your app.
- Android
- iOS
Detail documentation for each method, please go to see release notes for version 1.0.0
Track raw event (not recommended):
In case you want to manually track the ScreenViewEvent, use this function
Simply set trackingName, trackingContentType for the ViewController in swift code or in Xib file.
You need to set both of those properties to track screen view event.
Example:
TerraTracker will automatically track this ViewController visible event.
VisibleContentEvent#
There events indicate which contents are showing to user.
- Android
- iOS
RecyclerView support to auto-detect visible items and track when user scroll list:
Simply set trackingRegionName and trackingContentName for the UIView
Example:
InteractionContentEvent#
These events indicate user interactions with app, like clicking on buttons.
Firstly, define your app region, content and target like this:
- Android
- iOS
Firstly, define the region/content/target in your app like this
Then track the event when the button is clicked with this code
Firstly, define the region/content/target in your app like this
On the other hand, we can track tap action automatically by set trackingRegionName, trackingContentName, trackingPayload, trackingTarget for the UIView you want to track. You need to set enough 4 properties for track that view.
Example:
AlertEvent#
These events indicate that an popup message is showing, require user click to dismiss or make decision.
- Android
- iOS
With default UIAlertController, we only need to set these values then it will be tracked automatically when being presented.
ErrorEvent#
These events indicate that network exceptions have occurred.
- Android
- iOS
The library provides an ErrorTrackingInterceptor that can be used with OkHttp:
Add this interceptor when you build your OkHttp client. For Kotlin:
The library by default will read field code and message from the http response when http status is not success. If your server return different format, please
override ErrorTrackingInterceptor class with two functions:
getErrorCodeAndMessagereturn aPair<String, String>to indicate error code and error message, called when the http request is failed (non 2xx status)getCustomErrorCodeAndMessagereturn aPair<String, String>to indicate error code and error message, called when the http request is success (2xx status)
This will help the interceptor to correctly parse your failure code and message from server response.
To track the ErrorEvent on your own, use:
Http error events will be tracked automatically. You can add URLs to BLACKLIST_URL and WHITELIST_URL in the TekoTracker-Info.plist file to ignore or specify trackable urls.
If the whitelist is empty, all the urls that not included in the blacklist will be tracked.
URL values must start with http or https.
NOTE
If you want to track error response of an SDK, each API request must be added these value to headers
ExceptionEvent#
- Android
- iOS
The library automatically tracks this event
Add this line into the body of TerraApp.configure closure.
SearchEvent#
These events indicate the search action of user
- Android
- iOS
For Kotlin
PaymentEvent#
These events indicate the user action related to payment
- Android
- iOS
CheckoutEvent#
These events indicate user checkout the cart
- Android
- iOS
CustomEvent#
Use this event to track anything you need
- Android
- iOS
UTM Data#
We provide a way to track the utm data in the url where the app open from, includes: utm_source, utm_campaign, utm_term, utm_medium, utm_content.
- Android
- iOS
Add this line to your application's Activities
Add this line to the handle function when your app open from any url.
In our case, we need to add to these function in the AppDelegate: