public class

Event

extends Object
implements Serializable
java.lang.Object
   ↳ co.megacool.megacool.Event

Class Overview

Events are passed in the callback to start(Context, String, Megacool.OnEventsReceivedListener), which will be triggered as soon as the app opens.

Summary

Fields
public final EventType type What kind of event this is.
Public Methods
Date getCreatedAt()
The time the event happened.
Map<String, Object> getData()
Get any extra data associated with the event.
String getReceiverUserId()
For SENT_SHARE_OPENED events, get the receiving user's user id.
ReferralCode getReferralCode()
Get the referral code (if any).
String getSenderUserId()
For RECEIVED_SHARE_OPENED events, get the sender's user id.
Share getShare()
Get the Share that was involved in the event, for RECEIVED_SHARE_OPENED or SENT_SHARE_OPENED events.
String getUrl()
For link clicked events, get the URL that was clicked.
boolean isFirstSession()
Whether the event occurred in the first session or not on the originating device.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public final EventType type

What kind of event this is.

Public Methods

public Date getCreatedAt ()

The time the event happened.

public Map<String, Object> getData ()

Get any extra data associated with the event. You probably want to use the helpers getReferralCode(), getUrl(), getSenderUserId() and getReceiverUserId() instead of accessing this directly.

public String getReceiverUserId ()

For SENT_SHARE_OPENED events, get the receiving user's user id.

public ReferralCode getReferralCode ()

Get the referral code (if any). Always present for RECEIVED_SHARE_OPENED and SENT_SHARE_OPENED, might be present for LINK_CLICKED events.

Returns
  • The referral code involved in the event, if any.

public String getSenderUserId ()

For RECEIVED_SHARE_OPENED events, get the sender's user id.

public Share getShare ()

Get the Share that was involved in the event, for RECEIVED_SHARE_OPENED or SENT_SHARE_OPENED events.

public String getUrl ()

For link clicked events, get the URL that was clicked. This should be used to navigate to a specific section within your app.

Returns
  • The relative URL clicked, "/" or "/some/path?somearg=somevalue".

public boolean isFirstSession ()

Whether the event occurred in the first session or not on the originating device.

Use this with RECEIVED_SHARE_OPENED to determine if an installation came from Megacool or not. For SENT_SHARE_OPENED events, this can be used to determine whether the share resulted in a re-engaged user or a new install.

public String toString ()