public class GoogleAnalyticsConfig extends Object
Most of the properties are initialization level and request level. If a property is a initialization level property, it should be set at the time of GoogleAnalytics object initialization. If a property is a request level property, it can be set any time and it will be effective.
All properties of this config object supports method chaining. So for example, you could do,
new GoogleAnalyticsConfig().setMaxThreads(2).setThreadNameFormat("name");
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_HTTP_CONNECTIONS_PER_ROUTE |
| Constructor and Description |
|---|
GoogleAnalyticsConfig() |
| Modifier and Type | Method and Description |
|---|---|
int |
getBatchSize() |
String |
getBatchUrl() |
String |
getHttpsUrl() |
String |
getHttpUrl() |
int |
getMaxHttpConnectionsPerRoute() |
int |
getMaxThreads()
Maximum threads to use to process the asynchronous event posting and Http client connection pooling.
|
int |
getMinThreads() |
String |
getProxyHost() |
String |
getProxyPassword() |
int |
getProxyPort() |
String |
getProxyUserName() |
RequestParameterDiscoverer |
getRequestParameterDiscoverer() |
int |
getSamplePercentage()
The sample percentage to apply to all analytics.
|
String |
getThreadNameFormat() |
int |
getThreadQueueSize() |
int |
getThreadTimeoutSecs() |
String |
getUrl() |
String |
getUserAgent() |
boolean |
isBatchingEnabled() |
boolean |
isDiscoverRequestParameters() |
boolean |
isEnabled() |
boolean |
isGatherStats() |
boolean |
isUseHttps() |
boolean |
isValidate() |
static String |
mask(String value) |
GoogleAnalyticsConfig |
setBatchingEnabled(boolean batchingEnabled) |
GoogleAnalyticsConfig |
setBatchSize(int batchSize) |
GoogleAnalyticsConfig |
setBatchUrl(String batchUrl) |
GoogleAnalyticsConfig |
setDeriveSystemParameters(boolean deriveSystemProperties)
Deprecated.
Use
setDiscoverRequestParameters(boolean) instead |
GoogleAnalyticsConfig |
setDiscoverRequestParameters(boolean discoverSystemParameters)
If true, derives the system properties (User Language, Region, Country, Screen Size, Color Depth, and File
encoding) and adds to the default request.
|
GoogleAnalyticsConfig |
setEnabled(boolean enabled)
Enables or disables the GoogleAnalytics posting.
|
GoogleAnalyticsConfig |
setGatherStats(boolean gatherStats)
If set to true,
GoogleAnalyticsImpl will collect the basic stats about successful event postings for
various hit types and keeps a copy of GoogleAnalyticsStatsImpl, which can be retrieved using
GoogleAnalyticsImpl.getStats() |
GoogleAnalyticsConfig |
setHttpsUrl(String httpsUrl)
URL to use when posting the event in https mode.
|
GoogleAnalyticsConfig |
setHttpUrl(String httpUrl)
URL to use when posting the event in http mode.
|
GoogleAnalyticsConfig |
setMaxHttpConnectionsPerRoute(int maxHttpConnectionsPerRoute) |
GoogleAnalyticsConfig |
setMaxThreads(int maxThreads) |
GoogleAnalyticsConfig |
setMinThreads(int minThreads) |
GoogleAnalyticsConfig |
setProxyHost(String proxyHost)
Sets the host name of the proxy server, to connect to Google analytics.
|
GoogleAnalyticsConfig |
setProxyPassword(String proxyPassword)
Sets the password which should be used to authenticate to the proxy server.
|
GoogleAnalyticsConfig |
setProxyPort(int proxyPort)
Sets the host name of the proxy server, to connect to Google analytics.
|
GoogleAnalyticsConfig |
setProxyUserName(String proxyUserName)
Sets the user name which should be used to authenticate to the proxy server.
|
GoogleAnalyticsConfig |
setRequestParameterDiscoverer(RequestParameterDiscoverer requestParameterDiscoverer)
Sets the appropriate request parameter discoverer.
|
GoogleAnalyticsConfig |
setSamplePercentage(int samplePercentage) |
GoogleAnalyticsConfig |
setThreadNameFormat(String threadNameFormat)
Sets the thread name format that should be while creating the threads.
|
GoogleAnalyticsConfig |
setThreadQueueSize(int threadQueueSize) |
GoogleAnalyticsConfig |
setThreadTimeoutSecs(int threadTimeoutSecs) |
GoogleAnalyticsConfig |
setUseHttps(boolean useHttps)
Instructs to use https url to send the events.
|
GoogleAnalyticsConfig |
setUserAgent(String userAgent)
Sets the user agent string that should be sent while making the http request.
|
GoogleAnalyticsConfig |
setValidate(boolean validate)
If set, validates the request before sending to Google Analytics.
|
String |
toString() |
public static final int DEFAULT_MAX_HTTP_CONNECTIONS_PER_ROUTE
public RequestParameterDiscoverer getRequestParameterDiscoverer()
public GoogleAnalyticsConfig setRequestParameterDiscoverer(RequestParameterDiscoverer requestParameterDiscoverer)
DefaultRequestParameterDiscoverer but can
be changed to AwtRequestParameterDiscoverer if you want to use Toolkit to derive the screen resolution
etc.
Please make sure you also enable the discovery using setDiscoverRequestParameters(boolean)requestParameterDiscoverer - can be null and is so, parameters will not be discovered.public boolean isGatherStats()
public GoogleAnalyticsConfig setGatherStats(boolean gatherStats)
GoogleAnalyticsImpl will collect the basic stats about successful event postings for
various hit types and keeps a copy of GoogleAnalyticsStatsImpl, which can be retrieved using
GoogleAnalyticsImpl.getStats()gatherStats - public GoogleAnalyticsConfig setThreadNameFormat(String threadNameFormat)
Default is "googleanalytics-thread-{0}" where {0} is the thread counter. If you specify a custom format, make sure {0} is there somewhere otherwise all threads will be nameed same and can be an issue for troubleshooting.
threadNameFormat - non-null string for thread name.public String getThreadNameFormat()
@Deprecated public GoogleAnalyticsConfig setDeriveSystemParameters(boolean deriveSystemProperties)
setDiscoverRequestParameters(boolean) insteadpublic GoogleAnalyticsConfig setDiscoverRequestParameters(boolean discoverSystemParameters)
This is initialization level configuration (must be set while creating GoogleAnalytics object).
public boolean isDiscoverRequestParameters()
public GoogleAnalyticsConfig setProxyUserName(String proxyUserName)
setProxyHost(String) is not empty.
This is initialization level configuration (must be set while creating GoogleAnalytics object).
public String getProxyUserName()
public String getProxyPassword()
public GoogleAnalyticsConfig setProxyPassword(String proxyPassword)
setProxyHost(String) and setProxyUserName(String) is not empty.
This is initialization level configuration (must be set while creating GoogleAnalytics object).
public String getProxyHost()
public GoogleAnalyticsConfig setProxyHost(String proxyHost)
This is initialization level configuration (must be set while creating GoogleAnalytics object).
public int getProxyPort()
public GoogleAnalyticsConfig setProxyPort(int proxyPort)
This is initialization level configuration (must be set while creating GoogleAnalytics object).
public String getUserAgent()
public GoogleAnalyticsConfig setUserAgent(String userAgent)
Apache-HttpClient/release (java 1.5)
This is initialization level configuration (must be set while creating GoogleAnalytics object).
public boolean isEnabled()
public GoogleAnalyticsConfig setEnabled(boolean enabled)
false.
This is request level configuration (can be changed any time).
public int getMaxThreads()
This is initialization level configuration (must be set while creating GoogleAnalytics object).
public GoogleAnalyticsConfig setMaxThreads(int maxThreads)
public int getMinThreads()
public GoogleAnalyticsConfig setMinThreads(int minThreads)
public boolean isUseHttps()
public GoogleAnalyticsConfig setUseHttps(boolean useHttps)
This is request level configuration (can be changed any time).
public boolean isValidate()
public GoogleAnalyticsConfig setValidate(boolean validate)
This is request level configuration (can be changed any time).
public String getHttpUrl()
public GoogleAnalyticsConfig setHttpUrl(String httpUrl)
Default value is http://www.google-analytics.com/collect
This is request level configuration (can be changed any time).
public String getHttpsUrl()
public GoogleAnalyticsConfig setHttpsUrl(String httpsUrl)
Default value is https://www.google-analytics.com/collect
This is request level configuration (can be changed any time).
public String getUrl()
public int getMaxHttpConnectionsPerRoute()
public GoogleAnalyticsConfig setMaxHttpConnectionsPerRoute(int maxHttpConnectionsPerRoute)
public int getSamplePercentage()
public GoogleAnalyticsConfig setSamplePercentage(int samplePercentage)
public int getThreadQueueSize()
public GoogleAnalyticsConfig setThreadQueueSize(int threadQueueSize)
public int getThreadTimeoutSecs()
public GoogleAnalyticsConfig setThreadTimeoutSecs(int threadTimeoutSecs)
public String getBatchUrl()
public GoogleAnalyticsConfig setBatchUrl(String batchUrl)
public boolean isBatchingEnabled()
public GoogleAnalyticsConfig setBatchingEnabled(boolean batchingEnabled)
public int getBatchSize()
public GoogleAnalyticsConfig setBatchSize(int batchSize)
Copyright © Sep 2013–2018 Mike Hardy. All rights reserved.