public static interface AnalyticsFacade.Builder
Modifier and Type | Method and Description |
---|---|
@NotNull AnalyticsFacade |
build()
Creates and returns a new Analytics instance for this Builder.
|
@NotNull AnalyticsFacade.Builder |
putEventParameter(@NotNull String key,
@NotNull String value)
Associates the provided
value with the provided key in this builder's event parameters. |
@NotNull AnalyticsFacade.Builder |
putUserProperty(@NotNull String key,
@NotNull String value)
Associates the provided
value with the provided key in this builder's user properties. |
@NotNull AnalyticsFacade.Builder |
withClientIdFileName(@NotNull String clientIdFileName)
Specifies a custom file name to use when storing a persistent client id
used to identify returning users.
|
@NotNull AnalyticsFacade.Builder |
withDebugLogger(@NotNull Consumer<? super String> debugLogger)
Specifies a custom logger that will receive debug messages.
|
@NotNull AnalyticsFacade.Builder |
withErrorLogger(@NotNull Consumer<? super String> errorLogger)
Specifies a custom logger that will receive error messages.
|
@NotNull AnalyticsFacade.Builder |
withFrequencyLimit(int messages,
long duration,
@NotNull TimeUnit timeUnit)
Limits the frequency by which events can be sent upstream to Google Analytics.
|
@NotNull AnalyticsFacade.Builder |
withReportDespiteJUnit()
Specifies that reporting shall be made even though
JUnit test classes are available to the classloader.
|
@NotNull AnalyticsFacade.Builder |
withUrl(@NotNull String url)
Specifies a custom URL to use when connecting to Google Analytics.
|
@NotNull @NotNull AnalyticsFacade.Builder putUserProperty(@NotNull @NotNull String key, @NotNull @NotNull String value)
value
with the provided key
in this builder's user properties.
If the builder previously contained an association for the key, the old value is replaced
by the provided value.
The key will be used as a Google Analytics "user property" key with the associated value.
key
- to associatevalue
- to associate with the key@NotNull @NotNull AnalyticsFacade.Builder putEventParameter(@NotNull @NotNull String key, @NotNull @NotNull String value)
value
with the provided key
in this builder's event parameters.
If the builder previously contained an association for the key, the old value is replaced
by the provided value.
The key will be used as a Google Analytics "event parameter" key with the associated value.
key
- to associatevalue
- to associate with the key@NotNull @NotNull AnalyticsFacade.Builder withFrequencyLimit(int messages, long duration, @NotNull @NotNull TimeUnit timeUnit)
Events that are posted within the provided time limit, counted from the time the last message was successfully attempted upstream, are silently dropped.
Thus, the highest rate of messages sent upstream can be calculated using the
following function <p>
1.0d/timeUnit.toSeconds(duration)
<p>
which yields messages per second.
messages
- max number of messages to send per durationduration
- minimum duration between upstream messages.timeUnit
- for the provided duration.@NotNull @NotNull AnalyticsFacade.Builder withErrorLogger(@NotNull @NotNull Consumer<? super String> errorLogger)
The default logger is System.err::println
, i.e. messages will be
output to the error console.
The actual messages sent to the error logger are unspecified and shall not be acted on by logic.
errorLogger
- to use for error messages.@NotNull @NotNull AnalyticsFacade.Builder withDebugLogger(@NotNull @NotNull Consumer<? super String> debugLogger)
The default logger is s -> {}
, i.e. messages will be
discarded.
The actual messages sent to the debug logger are unspecified and shall not be acted on by logic.
debugLogger
- to use for debug messages.@NotNull @NotNull AnalyticsFacade.Builder withClientIdFileName(@NotNull @NotNull String clientIdFileName)
By default, a file named "chronicle.analytics.client.id" located in the user's home directory will be used.
clientIdFileName
- used to store the persistent client id.@NotNull @NotNull AnalyticsFacade.Builder withUrl(@NotNull @NotNull String url)
By default, the URL "https://www.google-analytics.com/mp/collect" will be used.
url
- used for remote connection@NotNull @NotNull AnalyticsFacade.Builder withReportDespiteJUnit()
By default, no reporting will be done if either of the classes `org.junit.jupiter.api.Test` or `org.junit.Test` are available to the classloader.
@NotNull @NotNull AnalyticsFacade build()
Copyright © 2021. All rights reserved.