public class AnalyticsClient extends Object
| Constructor and Description |
|---|
AnalyticsClient(String writeKey)
Creates a new Segment.io client.
|
AnalyticsClient(String writeKey,
Config config)
Creates a new Segment.io client.
|
| 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.
|
void |
close()
Closes the queue and the threads associated with flushing the queue
|
void |
flush()
Blocks until all messages in the queue are flushed.
|
Config |
getOptions() |
int |
getQueueDepth() |
AnalyticsStatistics |
getStatistics() |
String |
getWriteKey() |
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.
|
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 |
setWriteKey(String writeKey) |
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 AnalyticsClient(String writeKey)
writeKey - Your segment.io writeKey. You can get one of these by
registering for a project at https://segment.iopublic AnalyticsClient(String writeKey, Config config)
writeKey - Your segment.io writeKey. You can get one of these by
registering for a project at https://segment.ioconfig - Configure the behavior of this 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 void flush()
public void close()
public String getWriteKey()
public void setWriteKey(String writeKey)
public Config getOptions()
public AnalyticsStatistics getStatistics()
public int getQueueDepth()
Copyright © 2015. All Rights Reserved.