Skip to main content
You're viewing documentation for a previous version of this software.Switch to the latest stable version


Understanding how users engage with a product is critical to every business. Learn how to track how your users interact with the PhotoEditor SDK for Android.

The PhotoEditor SDK allows you to register an object that is being notified about events in real-time. You can then send these events to an analytics service of your choice. To receive events, you have to create a custom class that extends from EventTracker. This class has to be a Parcelable and must be annotated with

You have to create methods that are annotated with for all events that you want to track.

value = {LayerListSettings.Event.ADD_LAYER}, // Event name or names {...,...,...}, you will find all possible events in "Event" class inside our Settings classes.
doInitCall = true, // If true (default), the event is call after register the tracker, if the event is called in meantime.
ignoreReverts = true, // If false (default), the event is called also if the history has changed
triggerDelay = 30 // If set to a value > 10 the event is triggered once X milliseconds after the last event call.

Here is an example: The Kotlin code sample is currently unavailable due to restrictions by the Kotlin Annotation Processor (kapt).

public class ExampleCustomEventTracker extends EventTracker {
* This annotated method tracks any tool change like opening the brush tool
protected void changeToolView(UiStateMenu menuState) {
googleAnalyticsTracker.send(new HitBuilders.ScreenViewBuilder().build());
* This annotated method tracks contrast changes after a delay of 1000ms (triggerDelay) in order to prevent too many traking events.
* ignoreReverts = true means that this event is not triggered again if you cancel the changes.
@OnEvent(value = ColorAdjustmentSettings.Event.CONTRAST, ignoreReverts = true, triggerDelay = 1000)
protected void onColorAdjustmentChangeContrast(ColorAdjustmentSettings colorAdjustmentSettings) {
HitBuilders.EventBuilder builder = new HitBuilders.EventBuilder()
.setCategory("change color adjustment")
.setValue(Math.round(colorAdjustmentSettings.getContrast() * 100));
// Has to be a Parcalable. For example:
private String trackerId;
private Tracker googleAnalyticsTracker;
public ExampleCustomEventTracker(String trackerId) {
private void init(String trackerId) {
this.trackerId = trackerId;
GoogleAnalytics analytics = GoogleAnalytics.getInstance(PESDK.getAppContext());
googleAnalyticsTracker = analytics.newTracker(trackerId);
public int describeContents() {
return 0;
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
protected ExampleCustomEventTracker(Parcel in) {
public static final Creator<ExampleCustomEventTracker> CREATOR = new Creator<ExampleCustomEventTracker>() {
public ExampleCustomEventTracker createFromParcel(Parcel source) {
return new ExampleCustomEventTracker(source);
public ExampleCustomEventTracker[] newArray(int size) {
return new ExampleCustomEventTracker[size];

Now you have to add your CustomEventTracker to the settings class.

settingsList.setEventTracker(new CustomEventTracker(Application.ANALYTICS_TRACK_ID));