What you will learn
This tutorial will teach you how to tag your application with our mobile SDK, in order to retrieve and leverage all the beacon interaction analytics related to alerts from the Adtag platform.
The Adtag platform generates many types of analytics around beacon usage and interactions, based on the logs created by the mobile SDK.
For instance, the Adtag platform manages the following alert-related metrics:
- Number of alerts displayed for each beacon
- Number & percentage of 'clicked-through' alerts
While the mobile SDK automatically generates some logs, others need to be tagged manually in the application by developers.
How does the SDK send logs to the Adtag platform?
The SDK uses AdtagLogsManager to send logs to the Adtag platform.
AdtagLogsManager saves the logs in a specific database, and sends them in a dedicated thread when a maximum number of logs or a maximum waiting time is reached.
It exists as well a method called pushLogsNow that permits to send the logs save in database immediatly to the Adtag platform. This method is called each time a notification is displayed.
AdtagLogsManager allows you to configure:
- the maximum number of logs mentionned above
- the maximum waiting time mentionned above
- the network that your application can use to send the logs to the Adtag platform: it can be WIFI_ONLY or ALL (for all types of networks)
Default settings are:
- Maximum number of logs: 30
- Maximum waiting time: 25 seconds
- Network type: ALL
Alert display logs
Each time a beacon alert is displayed, an analytics log is automatically sent to the platform.
Each time a beacon alert is clicked, the SDK automatically creates a corresponding log.
This is what Connecthings calls a redirect log.
These automatic logs are possible because the SDK sets up a convention for your beacon notification intent. To help you, the SDK comes with the class BeaconIntent which provides several static methods to add the correct parameters to your beacon intent.
In the case of an alert, when an alert is clicked:
- If the click launches a new activity, you can use the configureAlertIntent method from the BeaconIntent class that helps to configure your intent to generate a 'Click-through' log
BeaconIntent.configureAlertIntent(YourIntentPackage, TheBeaconContent, RedirectType, TagOfYourActivity);
- If the click triggers a new action inside the new activity, use the sendRedirectLog method from the AdtagBeaconManager to send the log:
AdtagBeaconManager.getInstance().sendRedirectLog(TheBeaconContent, RedirectType, TagOfYourActivity);
The parameters of the methods are:
- BeaconContent: the beaconContent object for which the log is generated. It must be identifical to the object used to create the alert
- AdtaglogData.REDIRECT_TYPE: indicates the origin of the activity. In this case, the activity was launched from an alert: AdtagLogData.REDIRECT_TYPE.ALERT
- TAG: use it to provide additional contextual information regarding the alert - for example, the Activity that originally displayed the alert - Be sure to use the same tag than the iOs team
You can learn more about configuring your own BeaconAlertListener by reading the creating beacon alert tutorial