Skip to content

Broken matomo tracking with custom dimensions #1335

@kosarko

Description

@kosarko

ufal/dspace-angular@28fb578 has removed ds-view-tracker from both full-item-page.component and item-page.component.

In ufal/dspace-angular@6e40b57 the view-tracker component was modified to add dc_identifier into the event properties. Based on the presence of this property src/modules/app/browser-init.service.ts issues a _paq.push(['setCustomDimension', environment.matomo.dimensionId, properties.dc_identifier]); so this currently doesn't work

I can see the pageviews being tracked, so I guess there's some other mechanism that we need to modify.

The setup for this is following https://github.com/ufal/clarin-dspace/wiki/Start-Matomo we have two sites "views" and "downloads", each site has a custom dimension (on action; no extraction configured). I name this dimension "hdl".

They are stored in the db like this:

select * from matomo_custom_dimensions;
+-------------------+--------+------+-------+--------+--------+------------------------------------+----------------+
| idcustomdimension | idsite | name | index | scope  | active | extractions                        | case_sensitive |
+-------------------+--------+------+-------+--------+--------+------------------------------------+----------------+
|                 1 |      1 | hdl  |     1 | action |      1 | [{"dimension":"url","pattern":""}] |              1 |
|                 1 |      2 | hdl  |     1 | action |      1 | [{"dimension":"url","pattern":""}] |              1 |
+-------------------+--------+------+-------+--------+--------+------------------------------------+----------------+

When everything works correctly matomo has behaviour > hdl (on both sites, item-views appear in one, bitstream downloads in the other)

Image

the FE config has:

matomo:
  hostUrl: https://somematomourl/
  siteId: 1
  dimensionId: 1

the BE config has:

# matomo
matomo.track.enabled = true
matomo.auth.token = TOKEN
matomo.site.id = 1
matomo.tracker.bitstream.site_id = 2
matomo.tracker.oai.site_id = 1
matomo.tracker.host.url = https://samematomourl/matomo.php
matomo.custom.dimension.handle.id = 1

In addition to behavior > hdl, one can also check the matomo access.log for dimension1=SOMEHANDLE, or the matomo database:

select custom_dimension_1 from matomo_log_link_visit_action;

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions