Class TrackerConfiguration

java.lang.Object
org.matomo.java.tracking.TrackerConfiguration

public final class TrackerConfiguration extends Object
Defines configuration settings for the Matomo tracking.
  • Method Details

    • validate

      public void validate()
      Validates the auth token. The auth token must be exactly 32 characters long.
    • builder

    • getApiEndpoint

      public URI getApiEndpoint()
      The Matomo Tracking HTTP API endpoint, for example https://your-matomo-domain.example/matomo.php
    • getDefaultSiteId

      public Integer getDefaultSiteId()
      The default ID of the website that will be used if not specified explicitly.
    • getDefaultAuthToken

      public String getDefaultAuthToken()
      The authorization token (parameter token_auth) to use if not specified explicitly.
    • isEnabled

      public boolean isEnabled()
      Allows to stop the tracker to send requests to the Matomo endpoint.
    • getConnectTimeout

      public Duration getConnectTimeout()
      The timeout until a connection is established.

      A timeout value of zero is interpreted as an infinite timeout. A `null` value is interpreted as undefined (system default if applicable).

      Default: 5 seconds

    • getSocketTimeout

      public Duration getSocketTimeout()
      The socket timeout (SO_TIMEOUT), which is the timeout for waiting for data or, put differently, a maximum period inactivity between two consecutive data packets.

      A timeout value of zero is interpreted as an infinite timeout. A `null value is interpreted as undefined (system default if applicable).

      Default: 5 seconds

    • getProxyHost

      @Nullable public String getProxyHost()
      The hostname or IP address of an optional HTTP proxy. proxyPort must be configured as well
    • getProxyPort

      public int getProxyPort()
      The port of an HTTP proxy. proxyHost must be configured as well.
    • getProxyUsername

      @Nullable public String getProxyUsername()
      If the HTTP proxy requires a username for basic authentication, it can be configured here. Proxy host, port and password must also be set.
    • getProxyPassword

      @Nullable public String getProxyPassword()
      The corresponding password for the basic auth proxy user. The proxy host, port and username must be set as well.
    • getUserAgent

      public String getUserAgent()
      A custom user agent to be set. Defaults to "MatomoJavaClient"
    • isLogFailedTracking

      public boolean isLogFailedTracking()
      Logs if the Matomo Tracking API endpoint responds with an erroneous HTTP code. Defaults to false.
    • isDisableSslCertValidation

      public boolean isDisableSslCertValidation()
      Disables SSL certificate validation. This is useful for testing with self-signed certificates. Do not use in production environments. Defaults to false.

      Attention: This slows down performance

      See Also:
      • disableSslHostVerification
    • isDisableSslHostVerification

      public boolean isDisableSslHostVerification()
      Disables SSL host verification. This is useful for testing with self-signed certificates. Do not use in production environments. Defaults to false.

      If you use the Java 11 of the Matomo Java Tracker, this setting is ignored. Instead, you have to set the system property jdk.internal.httpclient.disableHostnameVerification as described in the Module java.net.http.

      See Also:
      • disableSslCertValidation
    • getThreadPoolSize

      public int getThreadPoolSize()
      The thread pool size for the async sender. Defaults to 2.

      Attention: If you use this library in a web application, make sure that this thread pool does not exceed the thread pool of the web application. Otherwise, you might run into problems.

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object