Skip to content

UFAL/Broken matomo tracking with custom dimensions#1237

Merged
milanmajchrak merged 2 commits intodtq-devfrom
ufal/matomo-dimensions-issue
Mar 10, 2026
Merged

UFAL/Broken matomo tracking with custom dimensions#1237
milanmajchrak merged 2 commits intodtq-devfrom
ufal/matomo-dimensions-issue

Conversation

@milanmajchrak
Copy link
Collaborator

Problem description

When ViewTrackerComponent was replaced by ViewTrackerResolverService (route resolver), the dc_identifier property was dropped from angulartics2 event properties. This broke Matomo custom dimension tracking — browser-init.service.ts checks properties.dc_identifier to call setCustomDimension, but it was always undefined.

Fix

Extract dc.identifier.uri from the resolved DSO and include it as dc_identifier in the event properties, restoring the behavior of the original component.

Analysis

(Write here, if there is needed describe some specific problem. Erase it, when it is not needed.)

Problems

(Write here, if some unexpected problems occur during solving issues. Erase it, when it is not needed.)

Sync verification

If en.json5 or cs.json5 translation files were updated:

  • Run yarn run sync-i18n -t src/assets/i18n/cs.json5 -i to synchronize messages, and changes are included in this PR.

Manual Testing (if applicable)

Copilot review

  • Requested review from Copilot

Copilot AI review requested due to automatic review settings March 9, 2026 15:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a regression in Matomo custom dimension tracking: when ViewTrackerComponent was replaced by ViewTrackerResolverService, the dc_identifier property (extracted from dc.identifier.uri metadata) was dropped from angulartics2 event properties. browser-init.service.ts checks properties.dc_identifier to call Matomo's setCustomDimension, so without it the custom dimension tracking silently broke. The fix extracts the dc.identifier.uri value from the resolved DSO and includes it as dc_identifier in the tracked event properties, matching the behavior of the original component.

Changes:

  • Service fix: extract dc.identifier.uri from the resolved DSO and include it as dc_identifier in the page_view event properties
  • New spec file covering the restored behavior across success, missing metadata, null DSO, and custom dsoPath scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/app/statistics/angulartics/dspace/view-tracker-resolver.service.ts Extracts dc_identifier from the resolved DSO and passes it in the event properties
src/app/statistics/angulartics/dspace/view-tracker-resolver.service.spec.ts New unit tests covering the dc_identifier behavior

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@milanmajchrak milanmajchrak merged commit 602a261 into dtq-dev Mar 10, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UFAL/Broken matomo tracking with custom dimensions

2 participants