Event tracking
Before sending any event ensure that the “install” has been successfully tracked. If an “install” is not recorded for the app on a device, Adtrace will receive and store your events, but they will NOT appear in the panel statistics.
Track event
You can use adtrace to track any event in your app. Suppose you want to track every tap on a button.
You would have to create a new event token in the panel.
Let's say that event token is abc123. In your button's click handler method you could then add the following lines to track the click:
AdTraceEvent adtraceEvent = new AdTraceEvent('abc123');
AdTrace.trackEvent(adtraceEvent);
Track revenue
If your users can generate revenue by tapping on advertisements or making in-app purchases you can track those revenues with events. Let's say a tap is worth one Euro cent. You could then track the revenue event like this:
AdTraceEvent adtraceEvent = new AdTraceEvent('abc123');
adtraceEvent.setRevenue(6, 'Toman');
AdTrace.trackEvent(adtraceEvent);
This can be combined with callback parameters of course.
When you set a currency token, Adtrace will automatically convert the incoming revenues into a reporting revenue of your choice.
Custom parameters
In addition to the data points that Adtrace SDK collects by default, you can use the Adtrace SDK to track and add to the event/session as many custom values as you need (user IDs, product IDs, etc.). Custom parameters are only available as raw data (i.e., they won't appear in the Adtrace panel).
You should use callback parameters for the values that you collect for your own internal use, and partner parameters for those that you wish to share with external partners. If a value (e.g. product ID) is tracked both for internal use and to forward it to external partners, the best practice would be to track it both as callback and partner parameters.
Event callback parameters
You can register a callback URL for your events in the panel. We will send a GET request to that URL whenever the event is tracked. You can add callback parameters to that event by calling addCallbackParameter to the event instance before tracking it. We will then append these parameters to your callback URL.
For example, suppose you have registered the URL https://www.adtrace.com/callback then track an event like this:
AdTraceEvent adtraceEvent = new AdTraceEvent('abc123');
adtraceEvent.addCallbackParameter('key', 'value');
adtraceEvent.addCallbackParameter('foo', 'bar');
AdTrace.trackEvent(adtraceEvent);
In that case we would track the event and send a request to:
https://www.adtrace.com/callback?key=value&foo=bar
It should be mentioned that we support a variety of placeholders like {gps_adid} that can be used as parameter values. In the resulting callback this placeholder would be replaced with the Google Play Services ID of the current device. Also note that we don't store any of your custom parameters, but only append them to your callbacks. If you haven't registered a callback for an event, these parameters won't even be read.
You can read more about using URL callbacks, including a full list of available values, in callbacks guide.
Event value parameters
You can also add parameters to be transmitted with the event, which have been activated in your Adtrace panel.
AdTraceEvent adtraceEvent = new AdTraceEvent('abc123');
adtraceEvent.addEventParameter('key', 'value');
adtraceEvent.addEventParameter('foo', 'bar');
AdTrace.trackEvent(adtraceEvent);
Event callback identifier
You can also add custom string identifier to each event you want to track. This identifier will later be reported in event success and/or event failure callbacks to enable you to keep track on which event was successfully tracked or not. You can set this identifier by assigning the callbackId member of your event instance:
AdTraceEvent adtraceEvent = new AdTraceEvent('abc123');
adtraceEvent.callbackId = '{CallbackId}';
AdTrace.trackEvent(adtraceEvent);