Skip to content

Commit 42c1db4

Browse files
committed
Upgrade to major 4 and remove deprecations
1 parent a308aba commit 42c1db4

58 files changed

Lines changed: 332 additions & 3057 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Official Matomo Java Tracker
22

3-
![Maven Central Version](https://img.shields.io/maven-central/v/org.piwik.java.tracking/matomo-java-tracker-core)
3+
![Maven Central Version](https://img.shields.io/maven-central/v/org.matomo.java/matomo-java-tracker-core)
44
[![Build Status](https://github.com/matomo-org/matomo-java-tracker/actions/workflows/build.yml/badge.svg)](https://github.com/matomo-org/matomo-java-tracker/actions/workflows/build.yml)
55
[![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/matomo-org/matomo-java-tracker.svg)](https://isitmaintained.com/project/matomo-org/matomo-java-tracker "Average time to resolve an issue")
66
[![Percentage of issues still open](https://isitmaintained.com/badge/open/matomo-org/matomo-java-tracker.svg)](https://isitmaintained.com/project/matomo-org/matomo-java-tracker "Percentage of issues still open")
@@ -69,7 +69,7 @@ Projects that use Matomo Java Tracker:
6969

7070
## What Is New?
7171

72-
### Version 3.5.x
72+
### Version 4.0.x
7373

7474
Added more tracking parameters for user agent data, ecommerce product, bot recording mode, HTTP status, bandwidth,
7575
source label and media attributes.
@@ -103,6 +103,40 @@ Jetty EE10 12.0.16 → 12.1.8, Jetty (javax) 10.0.24 → 10.0.26.
103103

104104
The local testing Docker setup now uses MariaDB 12 and Matomo 5.
105105

106+
The Maven groupId has changed from `org.piwik.java.tracking` to `org.matomo.java`. Update your
107+
dependency declarations accordingly.
108+
109+
All previously deprecated API has been removed as part of this major release. The following is a
110+
summary of the breaking changes and the recommended replacements:
111+
112+
- The `org.piwik.java.tracking` compatibility package has been removed entirely (`PiwikRequest`,
113+
`PiwikTracker`, `PiwikDate`, `PiwikLocale`, `CustomVariable`, `EcommerceItem`). Use the
114+
corresponding classes in `org.matomo.java.tracking` instead.
115+
- The deprecated `MatomoDate` and `MatomoLocale` classes have been removed. Use `java.time.Instant`
116+
and `org.matomo.java.tracking.parameters.Country` respectively.
117+
- The top-level `MatomoRequestBuilder` class has been removed. Use `MatomoRequest.request()` or
118+
`MatomoRequest.MatomoRequestBuilder` instead.
119+
- The deprecated `MatomoRequest(int siteId, String actionUrl)` constructor has been removed. Use
120+
`MatomoRequest.request()` builder instead.
121+
- Deprecated mutator methods on `MatomoRequest` have been removed: `setCustomTrackingParameter`,
122+
`addCustomTrackingParameter`, `clearCustomTrackingParameter`, `enableEcommerce`,
123+
`getEcommerceItem`, `addEcommerceItem`, `clearEcommerceItems`, `getPageCustomVariable`,
124+
`setPageCustomVariable`, `getUserCustomVariable`, `getVisitCustomVariable`,
125+
`setUserCustomVariable`, `setVisitCustomVariable`, `getRequestDatetime`, `setRequestDatetime`,
126+
`setParameter`, `builder()`, and `setDeviceResolution(String)`. Use the builder API
127+
(`MatomoRequest.request()...build()`) instead.
128+
- Deprecated constructors on `MatomoTracker` taking `hostUrl`, `proxyHost`, `proxyPort`, and
129+
`timeout` as individual arguments have been removed. Use
130+
`MatomoTracker(TrackerConfiguration)` instead.
131+
- The `sendRequestAsync(MatomoRequest, Function)` overload has been removed. Chain
132+
`CompletableFuture.thenApply()` on `sendRequestAsync(MatomoRequest)` instead.
133+
- The `sendBulkRequest(Iterable, String authToken)` and
134+
`sendBulkRequestAsync(Collection, String, Consumer)` / `sendBulkRequestAsync(Collection, String)`
135+
overloads have been removed. Set the auth token in `TrackerConfiguration` or on the requests
136+
directly, and chain `CompletableFuture.thenAccept()` for callbacks.
137+
- Deprecated `Country(Locale)` constructor and `Country.getLocale()` / `Country.setLocale(Locale)`
138+
methods have been removed. Construct `Country` from a country code string instead.
139+
106140
### Version 3.4.x
107141

108142
We fixed a synchronization issue in the Java 8 sender (https://github.com/matomo-org/matomo-java-tracker/issues/168).
@@ -129,7 +163,7 @@ See also the [Developer Guide here](https://developer.matomo.org/api-reference/t
129163
## Javadoc
130164

131165
The Javadoc for all versions can be found
132-
[at javadoc.io](https://javadoc.io/doc/org.piwik.java.tracking/matomo-java-tracker-core/latest/index.html). Thanks to
166+
[at javadoc.io](https://javadoc.io/doc/org.matomo.java/matomo-java-tracker-core/latest/index.html). Thanks to
133167
[javadoc.io](https://javadoc.io) for hosting it.
134168

135169
## Need help?
@@ -181,9 +215,9 @@ Add a dependency on Matomo Java Tracker using Maven. For Java 8:
181215
```xml
182216

183217
<dependency>
184-
<groupId>org.piwik.java.tracking</groupId>
218+
<groupId>org.matomo.java</groupId>
185219
<artifactId>matomo-java-tracker</artifactId>
186-
<version>3.5.0</version>
220+
<version>4.0.0</version>
187221
</dependency>
188222
```
189223

@@ -192,38 +226,38 @@ For Java 11 or newer:
192226
```xml
193227

194228
<dependency>
195-
<groupId>org.piwik.java.tracking</groupId>
229+
<groupId>org.matomo.java</groupId>
196230
<artifactId>matomo-java-tracker-java11</artifactId>
197-
<version>3.5.0</version>
231+
<version>4.0.0</version>
198232
</dependency>
199233
```
200234

201235
or Gradle (Java 8):
202236

203237
```groovy
204238
dependencies {
205-
implementation("org.piwik.java.tracking:matomo-java-tracker:3.5.0")
239+
implementation("org.matomo.java:matomo-java-tracker:4.0.0")
206240
}
207241
```
208242

209243
or Gradle (Java 11 or newer):
210244

211245
```groovy
212246
dependencies {
213-
implementation("org.piwik.java.tracking:matomo-java-tracker-java11:3.5.0")
247+
implementation("org.matomo.java:matomo-java-tracker-java11:4.0.0")
214248
}
215249
```
216250

217251
or Gradle with Kotlin DSL (Java 8)
218252

219253
```kotlin
220-
implementation("org.piwik.java.tracking:matomo-java-tracker:3.5.0")
254+
implementation("org.matomo.java:matomo-java-tracker:4.0.0")
221255
```
222256

223257
or Gradle with Kotlin DSL (Java 11 or newer)
224258

225259
```kotlin
226-
implementation("org.piwik.java.tracking:matomo-java-tracker-java11:3.5.0")
260+
implementation("org.matomo.java:matomo-java-tracker-java11:4.0.0")
227261
```
228262

229263
### Spring Boot Module
@@ -234,24 +268,24 @@ and allows you to configure the tracker via application properties. Add the foll
234268
```xml
235269

236270
<dependency>
237-
<groupId>org.piwik.java.tracking</groupId>
271+
<groupId>org.matomo.java</groupId>
238272
<artifactId>matomo-java-tracker-spring-boot-starter</artifactId>
239-
<version>3.5.0</version>
273+
<version>4.0.0</version>
240274
</dependency>
241275
```
242276

243277
or Gradle:
244278

245279
```groovy
246280
dependencies {
247-
implementation("org.piwik.java.tracking:matomo-java-tracker-spring-boot-starter:3.5.0")
281+
implementation("org.matomo.java:matomo-java-tracker-spring-boot-starter:4.0.0")
248282
}
249283
```
250284

251285
or Gradle with Kotlin DSL
252286

253287
```kotlin
254-
implementation("org.piwik.java.tracking:matomo-java-tracker-spring-boot-starter:3.5.0")
288+
implementation("org.matomo.java:matomo-java-tracker-spring-boot-starter:4.0.0")
255289
```
256290

257291
The following properties are supported:
@@ -265,7 +299,7 @@ The following properties are supported:
265299
| matomo.tracker.log-failed-tracking | Will send errors to the log if the Matomo Tracking API responds with an erroneous HTTP code |
266300
| matomo.tracker.connect-timeout | allows you to change the default connection timeout of 10 seconds. 0 is interpreted as infinite, null uses the system default |
267301
| matomo.tracker.socket-timeout | allows you to change the default socket timeout of 10 seconds. 0 is interpreted as infinite, null uses the system default |
268-
| matomo.tracker.user-agent | The user agent used by the request made to the endpoint. Default: `MatomoJavaClient` |
302+
| matomo.tracker.user-agent | The user agent used by the request made to the endpoint. Default: `MatomoJavaClient` |
269303
| matomo.tracker.proxy-host | The hostname or IP address of an optional HTTP proxy. `proxyPort` must be configured as well |
270304
| matomo.tracker.proxy-port | The port of an HTTP proxy. `proxyHost` must be configured as well. |
271305
| matomo.tracker.proxy-username | If the HTTP proxy requires a username for basic authentication, it can be configured with this method. Proxy host, port and password must also be set. |
@@ -718,9 +752,9 @@ version can be used in your local Maven repository for testing purposes, e.g.
718752

719753
```xml
720754
<dependency>
721-
<groupId>org.piwik.java.tracking</groupId>
755+
<groupId>org.matomo.java</groupId>
722756
<artifactId>matomo-java-tracker</artifactId>
723-
<version>3.5.0-SNAPSHOT</version>
757+
<version>4.0.0-SNAPSHOT</version>
724758
</dependency>
725759
```
726760

core/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<modelVersion>4.0.0</modelVersion>
44

55
<parent>
6-
<groupId>org.piwik.java.tracking</groupId>
6+
<groupId>org.matomo.java</groupId>
77
<artifactId>matomo-java-tracker-parent</artifactId>
8-
<version>3.5.0-SNAPSHOT</version>
8+
<version>4.0.0-SNAPSHOT</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

core/src/main/java/org/matomo/java/tracking/AuthToken.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@ private AuthToken() {
1717

1818
@Nullable
1919
static String determineAuthToken(
20-
@Nullable String overrideAuthToken,
2120
@Nullable Iterable<? extends MatomoRequest> requests,
2221
@Nullable TrackerConfiguration trackerConfiguration) {
23-
if (isNotBlank(overrideAuthToken)) {
24-
return overrideAuthToken;
25-
}
2622
if (requests != null) {
2723
for (MatomoRequest request : requests) {
2824
if (request != null && isNotBlank(request.getAuthToken())) {

core/src/main/java/org/matomo/java/tracking/CustomVariable.java

Lines changed: 0 additions & 30 deletions
This file was deleted.

core/src/main/java/org/matomo/java/tracking/EcommerceItem.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

core/src/main/java/org/matomo/java/tracking/MatomoDate.java

Lines changed: 0 additions & 66 deletions
This file was deleted.

core/src/main/java/org/matomo/java/tracking/MatomoLocale.java

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)