Class – Tracker.Event

Class

Tracker.Event

All Implemented Interfaces:

android.os.Parcelable

 

Enclosing Class:

Tracker


@AnyThread
public static class Tracker.Event
extends java.lang.Object
implements android.os.Parcelable

Event Builder for Standard and Custom Events.

Kochava standard post-install events have a finite list of event names and event keys. You can instrument your post-install events using one of the event names, and as many of the event keys (per event) as you would like. See the Post-Install Event Examples page for more information.

The standard event names and parameters cover a wide range of uses and should be used when possible. However sometimes your implementation will require something different, for those cases you can use the custom event name and parameter support provided by this class.

Use Tracker.Event(int) to create an Event with a standard name.

Use Tracker.Event(String) to create an Event with a custom name.

 

Event with Standard Name:

 

Event with Custom Name:

 

Event with In App Purchase Receipt:

It is recommended that every time you detect a new purchase or subscription renewal that you send the receipt along with any other known details such as the price and currency to Kochava.

 

NOTE: If setting the same parameter multiple times the most recent value will be used.

NOTE: Custom parameters can also conflict with and override built in keys. See the documentation for each parameter for its key to ensure you do not conflict.

 

Nested classes/interfaces inherited from interface android.os.Parcelable:

android.os.Parcelable.ClassLoaderCreator, android.os.Parcelable.Creator


Field Detail

Modifier and Type Field and Description
static android.os.Parcelable.Creator Creator
@NonNull
public static final android.os.Parcelable.Creator CREATOR

Creator for building an Event from a Parcel object.


Constructor Detail

Constructor Description
Event public Event(int type)

Creates an Event with a standard name.

Parameters:
type – Event Type. Tracker.EventType

Event public Event(@NonNull java.lang.String eventName)

Creates an Event with a custom name.

Event pre-registration is not required.

Event names may not be prepended with an underscore as that convention is reserved for Kochava events.

Parameters:
eventName – Custom Event Name.
Must be NonNull with a length >= 1.


Method Detail

Modifier and Type Method and Description
Tracker.Event addCustom
@CheckResult
@NonNull
public final Tracker.Event addCustom(@NonNull org.json.JSONObject keyValue)

Adds multiple key value pairs to the event.

Parameters:
keyValue – JSONObject containing key value pairs.

Returns:
Event Builder.

Tracker.Event addCustom
@CheckResult
@NonNull
public final Tracker.Event addCustom(@NonNull java.lang.String keyName, boolean value)

Adds a custom boolean value.

Parameters:
keyName – Custom key name.
value – Custom value to set.

Returns:
Event Builder.

Tracker.Event addCustom
@CheckResult
@NonNull
public final Tracker.Event addCustom(@NonNull java.lang.String keyName, @NonNull java.util.Date value)

Adds a custom Date value.

Format in UTC: 2017-09-27T17:12:39.706Z

Parameters:
keyName – Custom key name.
value – Custom value to set.

Returns:
Event Builder.

Tracker.Event addCustom
@CheckResult
@NonNull
public final Tracker.Event addCustom(@NonNull java.lang.String keyName, double value)

Adds a custom double value. Use for all custom decimal values.

Parameters:
keyName – Custom key name.
value – Custom value to set.

Returns:
Event Builder.

Tracker.Event addCustom
@CheckResult
@NonNull
public final Tracker.Event addCustom(@NonNull java.lang.String keyName, long value)

Adds a custom long value. Use for all custom whole number values.

Parameters:
keyName – Custom key name.
value – Custom value to set.

Returns:
Event Builder.

Tracker.Event addCustom
@CheckResult
@NonNull
public final Tracker.Event addCustom(@NonNull java.lang.String keyName, @NonNull java.lang.String value)

Adds a custom String value. Use for custom String values.

Convert values of unsupported types into Strings to pass in with this method.

Parameters:
keyName – Custom key name.
value – Custom value to set.

Returns:
Event Builder.

int describeContents
@Contract(pure=true)
public final int describeContents()

There are no special objects in this Parcelable instance.

Specified by:
describeContents in interface android.os.Parcelable

Returns:
0.

Tracker.Event setAction
@CheckResult
@NonNull
public final Tracker.Event setAction(@NonNull java.lang.String value)

Set the “action” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event

setAdCampaignId
@CheckResult
@NonNull
public final Tracker.Event setAdCampaignId(@NonNull java.lang.String value)

Set the “ad_campaign_id” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setAdCampaignName
@CheckResult
@NonNull
public final Tracker.Event setAdCampaignName(@NonNull java.lang.String value)

Set the “ad_campaign_name” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setAdDeviceType
@CheckResult
@NonNull
public final Tracker.Event setAdDeviceType(@NonNull java.lang.String value)

Set the ad “device_type” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setAdGroupId
@CheckResult
@NonNull
public final Tracker.Event setAdGroupId(@NonNull java.lang.String value)

Set the “ad_group_id” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setAdGroupName
@CheckResult
@NonNull
public final Tracker.Event setAdGroupName(@NonNull java.lang.String value)

Set the “ad_group_name” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setAdMediationName
@CheckResult
@NonNull
public final Tracker.Event setAdMediationName(@NonNull java.lang.String value)

Set the “ad_mediation_name” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setAdNetworkName
@CheckResult
@NonNull
public final Tracker.Event setAdNetworkName(@NonNull java.lang.String value)

Set the “ad_network_name” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setAdPlacement
@CheckResult
@NonNull
public final Tracker.Event setAdPlacement(@NonNull java.lang.String value)

Set the ad “placement” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setAdSize
@CheckResult
@NonNull
public final Tracker.Event setAdSize(@NonNull java.lang.String value)

Set the “ad_size” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setAdType
@CheckResult
@NonNull
public final Tracker.Event setAdType(@NonNull java.lang.String value)

Set the “ad_type” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setBackground
@CheckResult
@NonNull
public final Tracker.Event setBackground(boolean value)

Set the “background” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setCheckoutAsGuest
@CheckResult
@NonNull
public final Tracker.Event setCheckoutAsGuest(@NonNull java.lang.String value)

Set the “checkout_as_guest” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setCompleted
@CheckResult
@NonNull
public final Tracker.Event setCompleted(boolean value)

Set the “completed” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setContentId
@CheckResult
@NonNull
public final Tracker.Event setContentId(@NonNull java.lang.String value)

Set the “content_id” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setContentType
@CheckResult
@NonNull
public final Tracker.Event setContentType(@NonNull java.lang.String value)

Set the “content_type” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setCurrency
@CheckResult
@NonNull
public final Tracker.Event setCurrency(@NonNull java.lang.String value)

Set the “currency” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setDate
@CheckResult
@NonNull
public final Tracker.Event setDate(@NonNull java.util.Date value)

Set the “now_date” value.

Overrides setDate(String)

Format in UTC: 2017-09-27T17:12:39.706Z

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setDate
@CheckResult
@NonNull
public final Tracker.Event setDate(@NonNull java.lang.String value)

Set the “now_date” value.

Overrides setDate(Date)

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setDescription
@CheckResult
@NonNull
public final Tracker.Event setDescription(@NonNull java.lang.String value)

Set the “description” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setDestination
@CheckResult
@NonNull
public final Tracker.Event setDestination(@NonNull java.lang.String value)

Set the “destination” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setDuration
@CheckResult
@NonNull
public final Tracker.Event setDuration(double value)

Set the “duration” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setEndDate
@CheckResult
@NonNull
public final Tracker.Event setEndDate(@NonNull java.util.Date value)

Set the “end_date” value.

Overrides setEndDate(String)

Format in UTC: 2017-09-27T17:12:39.706Z

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setEndDate
@CheckResult
@NonNull
public final Tracker.Event setEndDate(@NonNull java.lang.String value)

Set the “end_date” value.

Overrides setEndDate(Date)

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setGooglePlayReceipt
@CheckResult
@NonNull
public final Tracker.Event setGooglePlayReceipt(@NonNull java.lang.String receiptJson, @NonNull java.lang.String receiptSignature)

Set Google Play In App Purchase receipt data.

It is recommended that every time a new purchase or subscription renewal is detected that the receipt along with any other known details such as the price and currency be sent to Kochava.

NOTE: In order to validate the In App Purchase receipt you must include your Google Play License Key within Partner Configuration -> Credentials -> Google AdMob – Android -> Public Key.

Parameters:
receiptJson – Data Json.
receiptSignature – Data Signature.

Returns:
Event Builder.

Tracker.Event setItemAddedFrom
@CheckResult
@NonNull
public final Tracker.Event setItemAddedFrom(@NonNull java.lang.String value)

Set the “item_added_from” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setLevel
@CheckResult
@NonNull
public final Tracker.Event setLevel(@NonNull java.lang.String value)

Set the “level” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setMaxRatingValue
@CheckResult
@NonNull
public final Tracker.Event setMaxRatingValue(double value)

Set the “max_rating_value” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setName
@CheckResult
@NonNull
public final Tracker.Event setName(@NonNull java.lang.String value)

Set the “name” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setOrderId
@CheckResult
@NonNull
public final Tracker.Event setOrderId(@NonNull java.lang.String value)

Set the “order_id” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setOrigin
@CheckResult
@NonNull
public final Tracker.Event setOrigin(@NonNull java.lang.String value)

Set the “origin” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setPayload
@CheckResult
@NonNull
public final Tracker.Event setPayload(@NonNull android.os.Bundle value)

Set the “payload” value.

Only simple types long, String, boolean, etc are supported. Unsupported types will be dropped.

Overrides setPayload(JSONObject)

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setPayload
@CheckResult
@NonNull
public final Tracker.Event setPayload(@NonNull org.json.JSONObject value)

Set the “payload” value.

Overrides setPayload(Bundle)

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setPrice
@CheckResult
@NonNull
public final Tracker.Event setPrice(double value)

Set the “price” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setQuantity
@CheckResult
@NonNull
public final Tracker.Event setQuantity(double value)

Set the “quantity” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setRatingValue
@CheckResult
@NonNull
public final Tracker.Event setRatingValue(double value)

Set the “rating_value” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setReceiptId
@CheckResult
@NonNull
public final Tracker.Event setReceiptId(@NonNull java.lang.String value)

Set the “receipt_id” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setReferralFrom
@CheckResult
@NonNull
public final Tracker.Event setReferralFrom(@NonNull java.lang.String value)

Set the “referral_from” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setRegistrationMethod
@CheckResult
@NonNull
public final Tracker.Event setRegistrationMethod(@NonNull java.lang.String value)

Set the “registration_method” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setResults
@CheckResult
@NonNull
public final Tracker.Event setResults(@NonNull java.lang.String value)

Set the “results” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setScore
@CheckResult
@NonNull
public final Tracker.Event setScore(@NonNull java.lang.String value)

Set the “score” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setSearchTerm
@CheckResult
@NonNull
public final Tracker.Event setSearchTerm(@NonNull java.lang.String value)

Set the “search_term” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setSpatialX
@CheckResult
@NonNull
public final Tracker.Event setSpatialX(double value)

Set the “spatial_x” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setSpatialY
@CheckResult
@NonNull
public final Tracker.Event setSpatialY(double value)

Set the “spatial_y” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setSpatialZ
@CheckResult
@NonNull
public final Tracker.Event setSpatialZ(double value)

Set the “spatial_z” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setStartDate
@CheckResult
@NonNull
public final Tracker.Event setStartDate(@NonNull java.util.Date value)

Set the “start_date” value.

Overrides setStartDate(String)

Format in UTC: 2017-09-27T17:12:39.706Z

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setStartDate
@CheckResult
@NonNull
public final Tracker.Event setStartDate(@NonNull java.lang.String value)

Set the “start_date” value.

Overrides setStartDate(Date)

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setSuccess
@CheckResult
@NonNull
public final Tracker.Event setSuccess(@NonNull java.lang.String value)

Set the “success” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setUserId
@CheckResult
@NonNull
public final Tracker.Event setUserId(@NonNull java.lang.String value)

Set the “user_id” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setUserName
@CheckResult
@NonNull
public final Tracker.Event setUserName(@NonNull java.lang.String value)

Set the “user_name” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

Tracker.Event setValidated
@CheckResult
@NonNull
public final Tracker.Event setValidated(@NonNull java.lang.String value)

Set the “validated” value.

Parameters:
value – Value to set.

Returns:
Event Builder.

void writeToParcel
public final void writeToParcel(@NonNull android.os.Parcel dest, int flags)

Writes this object out into a Parcel.

Specified by:
writeToParcel in interface android.os.Parcelable

Parameters:
dest – Destination Parcel.
flags – Flags.


See Also

Related Documentation Android In-app Billing Overview

This document describes the fundamental In-app Billing components and features that you need to understand in order to add In-app Billing features into your application.

 
 

Last Modified: Jul 6, 2018 at 3:26 pm