public class GoogleAnalyticsConfig
extends java.lang.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");
Constructor and Description |
---|
GoogleAnalyticsConfig() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getHttpsUrl() |
java.lang.String |
getHttpUrl() |
int |
getMaxThreads()
Maximum threads to use to process the asynchronous event posting and Http client connection pooling.
|
java.lang.String |
getProxyHost() |
java.lang.String |
getProxyPassword() |
int |
getProxyPort() |
java.lang.String |
getProxyUserName() |
RequestParameterDiscoverer |
getRequestParameterDiscoverer() |
java.lang.String |
getThreadNameFormat() |
java.lang.String |
getUserAgent() |
boolean |
isDeriveSystemParameters()
Deprecated.
Use
isDiscoverRequestParameters() instead |
boolean |
isDiscoverRequestParameters() |
boolean |
isEnabled() |
boolean |
isGatherStats() |
boolean |
isUseHttps() |
boolean |
isValidate() |
static java.lang.String |
mask(java.lang.String value) |
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.
|
void |
setGatherStats(boolean gatherStats)
If set to true,
GoogleAnalytics will collect the basic stats about successful event postings
for various hit types and keeps a copy of GoogleAnalyticsStats , which can be retrieved
using GoogleAnalytics.getStats() |
GoogleAnalyticsConfig |
setHttpsUrl(java.lang.String httpsUrl)
URL to use when posting the event in https mode.
|
GoogleAnalyticsConfig |
setHttpUrl(java.lang.String httpUrl)
URL to use when posting the event in http mode.
|
GoogleAnalyticsConfig |
setMaxThreads(int maxThreads) |
GoogleAnalyticsConfig |
setProxyHost(java.lang.String proxyHost)
Sets the host name of the proxy server, to connect to Google analytics.
|
GoogleAnalyticsConfig |
setProxyPassword(java.lang.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(java.lang.String proxyUserName)
Sets the user name which should be used to authenticate to the proxy server.
|
void |
setRequestParameterDiscoverer(RequestParameterDiscoverer requestParameterDiscoverer)
Sets the appropriate request parameter discoverer.
|
GoogleAnalyticsConfig |
setThreadNameFormat(java.lang.String threadNameFormat)
Sets the thread name format that should be while creating the threads.
|
GoogleAnalyticsConfig |
setUseHttps(boolean useHttps)
Instructs to use https url to send the events.
|
GoogleAnalyticsConfig |
setUserAgent(java.lang.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.
|
java.lang.String |
toString() |
public RequestParameterDiscoverer getRequestParameterDiscoverer()
public void 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 void setGatherStats(boolean gatherStats)
GoogleAnalytics
will collect the basic stats about successful event postings
for various hit types and keeps a copy of GoogleAnalyticsStats
, which can be retrieved
using GoogleAnalytics.getStats()
gatherStats
- public GoogleAnalyticsConfig setThreadNameFormat(java.lang.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 java.lang.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).
@Deprecated public boolean isDeriveSystemParameters()
isDiscoverRequestParameters()
insteadpublic boolean isDiscoverRequestParameters()
public GoogleAnalyticsConfig setProxyUserName(java.lang.String proxyUserName)
setProxyHost(String)
is not empty.
This is initialization level configuration (must be set while creating GoogleAnalytics object).
public java.lang.String getProxyUserName()
public java.lang.String getProxyPassword()
public GoogleAnalyticsConfig setProxyPassword(java.lang.String proxyPassword)
setProxyHost(String)
and setProxyUserName(String)
is not empty.
This is initialization level configuration (must be set while creating GoogleAnalytics object).
public java.lang.String getProxyHost()
public GoogleAnalyticsConfig setProxyHost(java.lang.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 java.lang.String getUserAgent()
public GoogleAnalyticsConfig setUserAgent(java.lang.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 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 java.lang.String getHttpUrl()
public GoogleAnalyticsConfig setHttpUrl(java.lang.String httpUrl)
Default value is http://www.google-analytics.com/collect
This is request level configuration (can be changed any time).
public java.lang.String getHttpsUrl()
public GoogleAnalyticsConfig setHttpsUrl(java.lang.String httpsUrl)
Default value is https://ssl.google-analytics.com/collect
This is request level configuration (can be changed any time).
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String mask(java.lang.String value)