Skip to content

Commit

Permalink
Send custom dimension also in oai tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmajchrak committed Nov 20, 2024
1 parent 97d3c1e commit 7fddbd0
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package org.dspace.app.statistics.clarin;

import java.util.LinkedHashMap;
import java.util.Objects;
import javax.servlet.http.HttpServletRequest;

Expand Down Expand Up @@ -56,6 +57,10 @@ protected void preTrack(Context context, MatomoRequest matomoRequest, Item item,
log.debug("Logging to site " + matomoRequest.getSiteId());
try {
matomoRequest.setPageCustomVariable(new CustomVariable("source", "oai"), 1);
// Add the Item handle into the request as a custom dimension
LinkedHashMap<Long, Object> handleDimension = new LinkedHashMap<>();
handleDimension.put(11L, item.getHandle());
matomoRequest.setDimensions(handleDimension);
} catch (MatomoException e) {
log.error(e);
}
Expand Down

0 comments on commit 7fddbd0

Please sign in to comment.