public class Analytics extends Object
| Constructor and Description |
|---|
Analytics() |
| Modifier and Type | Method and Description |
|---|---|
static void |
alias(String from,
String to)
Aliases an anonymous user into an identified user.
|
static void |
alias(String from,
String to,
Context context)
Aliases an anonymous user into an identified user.
|
static void |
alias(String from,
String to,
org.joda.time.DateTime timestamp)
Aliases an anonymous user into an identified user.
|
static void |
alias(String from,
String to,
org.joda.time.DateTime timestamp,
Context context)
Aliases an anonymous user into an identified user.
|
static void |
alias(String from,
String to,
org.joda.time.DateTime timestamp,
Context context,
Callback callback)
Aliases an anonymous user into an identified user.
|
static void |
close()
Closes the threads associated with the client
|
static void |
flush()
Blocks until all messages in the queue are flushed.
|
static AnalyticsClient |
getDefaultClient()
Fetches the default analytics client singleton
|
static AnalyticsStatistics |
getStatistics()
Returns statistics for the analytics client
|
static void |
identify(String userId,
Traits traits)
Identifying a user ties all of their actions to an id, and associates
user traits to that id.
|
static void |
identify(String userId,
Traits traits,
Context context)
Identifying a user ties all of their actions to an id, and associates
user traits to that id.
|
static void |
identify(String userId,
Traits traits,
org.joda.time.DateTime timestamp,
Context context)
Identifying a user ties all of their actions to an id, and associates
user traits to that id.
|
static void |
identify(String userId,
Traits traits,
org.joda.time.DateTime timestamp,
Context context,
Callback callback)
Identifying a user ties all of their actions to an id, and associates
user traits to that id.
|
static void |
initialize(String writeKey)
Creates a new Segment.io client.
|
static void |
initialize(String writeKey,
Options options)
Creates a new Segment.io client.
|
static void |
track(String userId,
String event)
Whenever a user triggers an event, you’ll want to track it.
|
static void |
track(String userId,
String event,
EventProperties properties)
Whenever a user triggers an event, you’ll want to track it.
|
static void |
track(String userId,
String event,
EventProperties properties,
org.joda.time.DateTime timestamp)
Whenever a user triggers an event, you’ll want to track it.
|
static void |
track(String userId,
String event,
EventProperties properties,
org.joda.time.DateTime timestamp,
Context context)
Whenever a user triggers an event, you’ll want to track it.
|
static void |
track(String userId,
String event,
EventProperties properties,
org.joda.time.DateTime timestamp,
Context context,
Callback callback)
Whenever a user triggers an event, you’ll want to track it.
|
public static final String VERSION
public static void initialize(String writeKey)
writeKey - Your segment.io writeKey. You can get one of these by
registering for a project at https://segment.iopublic static void initialize(String writeKey, Options options)
writeKey - Your segment.io writeKey. You can get one of these by
registering for a project at https://segment.iooptions - Options to configure the behavior of the Segment.io clientpublic static void identify(String userId, Traits traits)
userId - the user's id after they are logged in. It's the same id as
which you would recognize a signed-in user in your system.traits - a dictionary with keys like subscriptionPlan or age. You only
need to record a trait once, no need to send it again.public static void identify(String userId, Traits traits, Context context)
userId - the user's id after they are logged in. It's the same id as
which you would recognize a signed-in user in your system.traits - a dictionary with keys like subscriptionPlan or age. You only
need to record a trait once, no need to send it again.context - an object that describes anything that doesn't fit into this
event's properties (such as the user's IP)public static void identify(String userId, Traits traits, org.joda.time.DateTime timestamp, Context context)
userId - the user's id after they are logged in. It's the same id as
which you would recognize a signed-in user in your system.traits - a dictionary with keys like subscriptionPlan or age. You only
need to record a trait once, no need to send it again.timestamp - a DateTime representing when the identify took place.
If the identify just happened, leave it blank and we'll use
the server's time. If you are importing data from the past,
make sure you provide this argument.context - an object that describes anything that doesn't fit into this
event's properties (such as the user's IP)spublic static void identify(String userId, Traits traits, org.joda.time.DateTime timestamp, Context context, Callback callback)
userId - the user's id after they are logged in. It's the same id as
which you would recognize a signed-in user in your system.traits - a dictionary with keys like subscriptionPlan or age. You only
need to record a trait once, no need to send it again.timestamp - a DateTime representing when the identify took place.
If the identify just happened, leave it blank and we'll use
the server's time. If you are importing data from the past,
make sure you provide this argument.context - an object that describes anything that doesn't fit into this
event's properties (such as the user's IP)callback - a callback that is fired when this track's batch is flushed to
the server. Note: this callback is fired on the same thread as
the async event loop that made the request. You should not
perform any kind of long running operation on it.public static void track(String userId, String event, EventProperties properties)
userId - the user's id after they are logged in. It's the same id as
which you would recognize a signed-in user in your system.event - describes what this user just did. It's a human readable
description like "Played a Song", "Printed a Report" or
"Updated Status".properties - a dictionary with items that describe the event in more
detail. This argument is optional, but highly
recommended—you’ll find these properties extremely useful
later.public static void track(String userId, String event)
userId - the user's id after they are logged in. It's the same id as
which you would recognize a signed-in user in your system.event - describes what this user just did. It's a human readable
description like "Played a Song", "Printed a Report" or
"Updated Status".public static void track(String userId, String event, EventProperties properties, org.joda.time.DateTime timestamp)
userId - the user's id after they are logged in. It's the same id as
which you would recognize a signed-in user in your system.properties - a dictionary with items that describe the event in more
detail. This argument is optional, but highly
recommended—you’ll find these properties extremely useful
later.event - describes what this user just did. It's a human readable
description like "Played a Song", "Printed a Report" or
"Updated Status".timestamp - a DateTime object representing when the track took
place. If the event just happened, leave it blank and we'll
use the server's time. If you are importing data from the
past, make sure you provide this argument.public static void track(String userId, String event, EventProperties properties, org.joda.time.DateTime timestamp, Context context)
userId - the user's id after they are logged in. It's the same id as
which you would recognize a signed-in user in your system.event - describes what this user just did. It's a human readable
description like "Played a Song", "Printed a Report" or
"Updated Status".properties - a dictionary with items that describe the event in more
detail. This argument is optional, but highly
recommended—you’ll find these properties extremely useful
later.timestamp - a DateTime object representing when the track took
place. If the event just happened, leave it blank and we'll
use the server's time. If you are importing data from the
past, make sure you provide this argument.context - an object that describes anything that doesn't fit into this
event's properties (such as the user's IP)public static void track(String userId, String event, EventProperties properties, org.joda.time.DateTime timestamp, Context context, Callback callback)
userId - the user's id after they are logged in. It's the same id as
which you would recognize a signed-in user in your system.event - describes what this user just did. It's a human readable
description like "Played a Song", "Printed a Report" or
"Updated Status".properties - a dictionary with items that describe the event in more
detail. This argument is optional, but highly
recommended—you’ll find these properties extremely useful
later.timestamp - a DateTime object representing when the track took
place. If the event just happened, leave it blank and we'll
use the server's time. If you are importing data from the
past, make sure you provide this argument.context - an object that describes anything that doesn't fit into this
event's properties (such as the user's IP)callback - a callback that is fired when this track's batch is flushed to
the server. Note: this callback is fired on the same thread as
the async event loop that made the request. You should not
perform any kind of long running operation on it.public static void alias(String from, String to)
from - the anonymous user's id before they are logged in.to - the identified user's id after they're logged in.public static void alias(String from, String to, org.joda.time.DateTime timestamp)
from - the anonymous user's id before they are logged in.to - the identified user's id after they're logged in.timestamp - a DateTime object representing when the track took
place. If the event just happened, leave it blank and we'll
use the server's time. If you are importing data from the
past, make sure you provide this argument.public static void alias(String from, String to, Context context)
from - the anonymous user's id before they are logged in.to - the identified user's id after they're logged in.context - an object that describes anything that doesn't fit into this
event's properties (such as the user's IP)public static void alias(String from, String to, org.joda.time.DateTime timestamp, Context context)
from - the anonymous user's id before they are logged in.to - the identified user's id after they're logged in.timestamp - a DateTime object representing when the track took
place. If the event just happened, leave it blank and we'll
use the server's time. If you are importing data from the
past, make sure you provide this argument.context - an object that describes anything that doesn't fit into this
event's properties (such as the user's IP)public static void alias(String from, String to, org.joda.time.DateTime timestamp, Context context, Callback callback)
from - the anonymous user's id before they are logged in.to - the identified user's id after they're logged in.timestamp - a DateTime object representing when the track took
place. If the event just happened, leave it blank and we'll
use the server's time. If you are importing data from the
past, make sure you provide this argument.context - an object that describes anything that doesn't fit into this
event's properties (such as the user's IP)callback - a callback that is fired when this track's batch is flushed to
the server. Note: this callback is fired on the same thread as
the async event loop that made the request. You should not
perform any kind of long running operation on it.public static void flush()
public static void close()
public static AnalyticsStatistics getStatistics()
public static AnalyticsClient getDefaultClient()
Copyright © 2014. All Rights Reserved.