public class GoogleAnalytics
extends java.lang.Object
GoogleAnalyticsConfig
and DefaultRequest
.
Configuration contains sensible defaults so one could just initialize using one of the convenience constructors.
This object is ThreadSafe and it is intended that clients create one instance of this for each GA Tracker Id
and reuse each time an event needs to be posted.
This object contains resources which needs to be shutdown/disposed. So close()
method is called
to release all resources. Once close method is called, this instance cannot be reused so create new instance
if required.
This copy of google-analytics-java is a back port of version 1.1.1 of the library.
This backport removes the slf4j dependency, and modifies the code to work with the
4.1 version of the Apache http client library.
Original sources can be found at https://github.com/brsanthu/google-analytics-java.
All copyrights retained by original authors.Constructor and Description |
---|
GoogleAnalytics(GoogleAnalyticsConfig config,
DefaultRequest defaultRequest) |
GoogleAnalytics(GoogleAnalyticsConfig config,
java.lang.String trackingId) |
GoogleAnalytics(GoogleAnalyticsConfig config,
java.lang.String trackingId,
java.lang.String appName,
java.lang.String appVersion) |
GoogleAnalytics(java.lang.String trackingId) |
GoogleAnalytics(java.lang.String trackingId,
java.lang.String appName,
java.lang.String appVersion) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected java.util.concurrent.ThreadPoolExecutor |
createExecutor(GoogleAnalyticsConfig config) |
protected org.apache.http.client.HttpClient |
createHttpClient(GoogleAnalyticsConfig config) |
protected java.util.concurrent.ThreadFactory |
createThreadFactory() |
GoogleAnalyticsConfig |
getConfig() |
protected int |
getDefaultMaxPerRoute(GoogleAnalyticsConfig config) |
DefaultRequest |
getDefaultRequest() |
boolean |
getEnabled() |
protected java.util.concurrent.ThreadPoolExecutor |
getExecutor() |
org.apache.http.client.HttpClient |
getHttpClient() |
GoogleAnalyticsStats |
getStats() |
GoogleAnalyticsResponse |
post(GoogleAnalyticsRequest request) |
java.util.concurrent.Future<GoogleAnalyticsResponse> |
postAsync(GoogleAnalyticsRequest request) |
java.util.concurrent.Future<GoogleAnalyticsResponse> |
postAsync(RequestProvider requestProvider) |
void |
resetStats() |
void |
setDefaultRequest(DefaultRequest request) |
void |
setEnabled(boolean b) |
void |
setHttpClient(org.apache.http.client.HttpClient httpClient) |
public GoogleAnalytics(java.lang.String trackingId)
public GoogleAnalytics(GoogleAnalyticsConfig config, java.lang.String trackingId)
public GoogleAnalytics(java.lang.String trackingId, java.lang.String appName, java.lang.String appVersion)
public GoogleAnalytics(GoogleAnalyticsConfig config, java.lang.String trackingId, java.lang.String appName, java.lang.String appVersion)
public GoogleAnalytics(GoogleAnalyticsConfig config, DefaultRequest defaultRequest)
public GoogleAnalyticsConfig getConfig()
public org.apache.http.client.HttpClient getHttpClient()
public DefaultRequest getDefaultRequest()
public void setDefaultRequest(DefaultRequest request)
public void setHttpClient(org.apache.http.client.HttpClient httpClient)
public GoogleAnalyticsResponse post(GoogleAnalyticsRequest request)
public java.util.concurrent.Future<GoogleAnalyticsResponse> postAsync(RequestProvider requestProvider)
public java.util.concurrent.Future<GoogleAnalyticsResponse> postAsync(GoogleAnalyticsRequest request)
public void close()
protected org.apache.http.client.HttpClient createHttpClient(GoogleAnalyticsConfig config)
protected int getDefaultMaxPerRoute(GoogleAnalyticsConfig config)
protected java.util.concurrent.ThreadPoolExecutor getExecutor()
protected java.util.concurrent.ThreadPoolExecutor createExecutor(GoogleAnalyticsConfig config)
protected java.util.concurrent.ThreadFactory createThreadFactory()
public GoogleAnalyticsStats getStats()
public void resetStats()
public void setEnabled(boolean b)
public boolean getEnabled()