Class MatomoTrackerProperties

java.lang.Object
org.matomo.java.tracking.spring.MatomoTrackerProperties

@ConfigurationProperties(prefix="matomo.tracker") public class MatomoTrackerProperties extends Object
Configuration properties for the Matomo Tracker.

These properties can be configured in the application.properties file. For example:

   matomo.tracker.api-endpoint=https://your-matomo-domain.example/matomo.php
   matomo.tracker.default-site-id=1
   matomo.tracker.default-auth-token=1234567890abcdef1234567890abcdef
   matomo.tracker.enabled=true
   matomo.tracker.connect-timeout=10s
   matomo.tracker.socket-timeout=30s
   matomo.tracker.proxy-host=proxy.example.com
   matomo.tracker.proxy-port=8080
   matomo.tracker.proxy-username=proxyuser
   matomo.tracker.proxy-password=proxypassword
   matomo.tracker.user-agent=MatomoJavaClient
   matomo.tracker.log-failed-tracking=true
   matomo.tracker.disable-ssl-cert-validation=true
   matomo.tracker.disable-ssl-host-validation=true
   matomo.tracker.thread-pool-size=2
 
See Also:
  • Constructor Details

    • MatomoTrackerProperties

      public MatomoTrackerProperties()
  • Method Details

    • getApiEndpoint

      public String getApiEndpoint()
      The Matomo Tracking HTTP API endpoint. 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.
    • getEnabled

      public Boolean getEnabled()
      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: 10 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: 30 seconds

    • getProxyHost

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

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

      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

      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"
    • getLogFailedTracking

      public Boolean getLogFailedTracking()
      Logs if the Matomo Tracking API endpoint responds with an erroneous HTTP code. Defaults to false.
    • getDisableSslCertValidation

      public Boolean getDisableSslCertValidation()
      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
    • getDisableSslHostVerification

      public Boolean getDisableSslHostVerification()
      Disables SSL host verification. 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:
      • disableSslCertValidation
    • getThreadPoolSize

      public Integer 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.

    • setApiEndpoint

      public void setApiEndpoint(String apiEndpoint)
      The Matomo Tracking HTTP API endpoint. Example: https://your-matomo-domain.example/matomo.php
    • setDefaultSiteId

      public void setDefaultSiteId(Integer defaultSiteId)
      The default ID of the website that will be used if not specified explicitly.
    • setDefaultAuthToken

      public void setDefaultAuthToken(String defaultAuthToken)
      The authorization token (parameter token_auth) to use if not specified explicitly.
    • setEnabled

      public void setEnabled(Boolean enabled)
      Allows to stop the tracker to send requests to the Matomo endpoint.
    • setConnectTimeout

      public void setConnectTimeout(Duration connectTimeout)
      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: 10 seconds

    • setSocketTimeout

      public void setSocketTimeout(Duration socketTimeout)
      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: 30 seconds

    • setProxyHost

      public void setProxyHost(String proxyHost)
      The hostname or IP address of an optional HTTP proxy. proxyPort must be configured as well
    • setProxyPort

      public void setProxyPort(Integer proxyPort)
      The port of an HTTP proxy. proxyHost must be configured as well.
    • setProxyUsername

      public void setProxyUsername(String proxyUsername)
      If the HTTP proxy requires a username for basic authentication, it can be configured here. Proxy host, port and password must also be set.
    • setProxyPassword

      public void setProxyPassword(String proxyPassword)
      The corresponding password for the basic auth proxy user. The proxy host, port and username must be set as well.
    • setUserAgent

      public void setUserAgent(String userAgent)
      A custom user agent to be set. Defaults to "MatomoJavaClient"
    • setLogFailedTracking

      public void setLogFailedTracking(Boolean logFailedTracking)
      Logs if the Matomo Tracking API endpoint responds with an erroneous HTTP code. Defaults to false.
    • setDisableSslCertValidation

      public void setDisableSslCertValidation(Boolean disableSslCertValidation)
      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
    • setDisableSslHostVerification

      public void setDisableSslHostVerification(Boolean disableSslHostVerification)
      Disables SSL host verification. 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:
      • disableSslCertValidation
    • setThreadPoolSize

      public void setThreadPoolSize(Integer threadPoolSize)
      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.