public class Analytics extends Object
| Constructor and Description |
|---|
Analytics() |
| Modifier and Type | Method and Description |
|---|---|
void |
alias(String previousId,
String userId)
Aliases an anonymous user into an identified user.
|
void |
alias(String previousId,
String userId,
Options options)
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
|
void |
group(String userId,
String groupId,
Traits traits)
The `group` method lets you associate a user with a group.
|
void |
group(String userId,
String groupId,
Traits traits,
Options options)
The `group` method lets you associate a user with a group.
|
void |
identify(String userId)
Identifying a user ties all of their actions to an id, and associates
user traits to that id.
|
void |
identify(String userId,
Traits traits)
Identifying a user ties all of their actions to an id, and associates
user traits to that id.
|
void |
identify(String userId,
Traits traits,
Options options)
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,
Config options)
Creates a new Segment.io client.
|
void |
page(String userId,
String name)
The `page` method let your record whenever a user sees a web page on
your web site, and attach a `name`, `category` or `properties` to the web page load.
|
void |
page(String userId,
String name,
Props properties)
The `page` method let your record whenever a user sees a web page on
your web site, and attach a `name`, `category` or `properties` to the web page load.
|
void |
page(String userId,
String name,
Props properties,
Options options)
The `page` method let your record whenever a user sees a web page on
your web site, and attach a `name`, `category` or `properties` to the web page load.
|
void |
page(String userId,
String name,
String category,
Props properties,
Options options)
The `page` method let your record whenever a user sees a web page on
your web site, and attach a `name`, `category` or `properties` to the web page load.
|
void |
screen(String userId,
String name)
The `screen` method let your record whenever a user sees a mobile screen,
and attach a `name`, `category` or `properties` to the web page load.
|
void |
screen(String userId,
String name,
Props properties)
The `screen` method let your record whenever a user sees a mobile screen,
and attach a `name`, `category` or `properties` to the web page load.
|
void |
screen(String userId,
String name,
Props properties,
Options options)
The `screen` method let your record whenever a user sees a mobile screen,
and attach a `name`, `category` or `properties` to the web page load.
|
void |
screen(String userId,
String name,
String category,
Props properties,
Options options)
The `screen` method let your record whenever a user sees a mobile screen,
and attach a `name`, `category` or `properties` to the web page load.
|
void |
track(String userId,
String event)
Whenever a user triggers an event, you’ll want to track it.
|
void |
track(String userId,
String event,
Props properties)
Whenever a user triggers an event, you’ll want to track it.
|
void |
track(String userId,
String event,
Props properties,
Options options)
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, Config 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 void identify(String userId)
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.public 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 void identify(String userId, Traits traits, Options options)
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.options - options allows you to set a timestamp,
an anonymousId, a context, and target integrations.public void group(String userId, String groupId, 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.groupId - the group's id as it would appear in your database.traits - a dictionary with keys like subscriptionPlan or age. You only
need to record a trait once, no need to send it again.public void group(String userId, String groupId, Traits traits, Options options)
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.groupId - the group's id as it would appear in your database.traits - a dictionary with keys like subscriptionPlan or age. You only
need to record a trait once, no need to send it again.options - options allows you to set a timestamp,
an anonymousId, a context, and target integrations.public 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 void track(String userId, String event, Props 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 void track(String userId, String event, Props properties, Options options)
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.options - options allows you to set a timestamp,
an anonymousId, a context, and target integrations.public void page(String userId, String name)
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.name - The name of the web page, like "Signup", "Login"public void page(String userId, String name, Props 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.name - The name of the web page, like "Signup", "Login"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 void page(String userId, String name, Props properties, Options options)
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.name - The name of the web page, like "Signup", "Login"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.options - options allows you to set a timestamp,
an anonymousId, a context, and target integrations.public void page(String userId, String name, String category, Props properties, Options options)
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.name - The name of the web page, like "Signup", "Login"category - The category of the web page, like "Sports" or "Authentication"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.options - options allows you to set a timestamp,
an anonymousId, a context, and target integrations.public void screen(String userId, String name)
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.name - The name of the mobile screen, like "Signup", "Login"public void screen(String userId, String name, Props 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.name - The name of the mobile screen, like "Signup", "Login"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 void screen(String userId, String name, Props properties, Options options)
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.name - The name of the mobile screen, like "Signup", "Login"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.options - options allows you to set a timestamp,
an anonymousId, a context, and target integrations.public void screen(String userId, String name, String category, Props properties, Options options)
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.name - The name of the mobile screen, like "Signup", "Login"category - The category of the web page, like "Sports" or "Authentication"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.options - options allows you to set a timestamp,
an anonymousId, a context, and target integrations.public void alias(String previousId, String userId)
previousId - the anonymous user's id before they are logged in.userId - the identified user's id after they're logged in.public void alias(String previousId, String userId, Options options)
previousId - the anonymous user's id before they are logged in.userId - the identified user's id after they're logged in.options - options allows you to set a timestamp,
an anonymousId, a context, and target integrations.public static void flush()
public static void close()
public static AnalyticsStatistics getStatistics()
public static AnalyticsClient getDefaultClient()
Copyright © 2015. All Rights Reserved.