Hola, para integrar Matomo en DSpace 7.x, me sirvio modificar el archivo 
footer.component.ts, dentro del archivo debes colocar lo siguiente:

import { Component, AfterViewInit, Renderer2, ElementRef } from 
'@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { FooterComponent as BaseComponent } from 
'../../../../app/footer/footer.component';

declare global {
  interface Window {
    _paq: any[];
  }
}

@Component({
  selector: 'ds-footer',
  styleUrls: ['footer.component.scss'],
  templateUrl: 'footer.component.html'
})

export class FooterComponent implements AfterViewInit {
  currentYear = new Date().getFullYear();
  private previousPageUrl: string;
  constructor(
    private renderer: Renderer2,
    private el: ElementRef,
    private router: Router
  ) {}

  ngAfterViewInit() {
    this.initializeMatomo();
    this.trackPageViews();
  }
  private initializeMatomo() {
    window._paq = window._paq || [];
    window._paq.push(['trackPageView']);
    window._paq.push(['enableLinkTracking']);
    window._paq.push(['setTrackerUrl', '//URL_MATOMO/matomo.php']);
    window._paq.push(['setSiteId', '1']);
    const script = this.renderer.createElement('script');
    script.type = 'text/javascript';
    script.async = true;
    script.src = '// URL_MATOMO/matomo.js';
    this.renderer.appendChild(this.el.nativeElement, script);
  }

  private trackPageViews() {
    this.router.events.subscribe(event => {
      if (event instanceof NavigationEnd) {
        if (this.previousPageUrl) {
          window._paq.push(['setReferrerUrl', this.previousPageUrl]);
        }
        window._paq.push(['setCustomUrl', window.location.pathname + 
window.location.search]);
        window._paq.push(['setDocumentTitle', document.title]);
        window._paq.push(['trackPageView']);
        this.previousPageUrl = window.location.href;
      }
    });
  }
}

De esta forma Matomo comenzará a rastrear toda la actividad dentro de 
DSpace. Luego solo debes incorporar el atributo download="download" dentro 
del archivo file-download-link.html

<a [routerLink]="(bitstreamPath$| async)?.routerLink" download="download" 
class="dont-break-out" [queryParams]="(bitstreamPath$| async)?.queryParams" 
[target]="isBlank ? '_blank': '_self'" [ngClass]="cssClasses">

Agregando el atributo download, matomo comprende que cuando el usuario hace 
clic en el enlace de descarga, es efectivamente una descarga.

Aplicando estos cambios, Matomo debería capturar datos sin problema, al 
menos a mi me funciona sin problema.

El jueves, 19 de octubre de 2023 a las 4:41:17 UTC-3, Sarfaraz Mohamed 
escribió:

> Thank you 
> much appreciated 
>
> On Wednesday, 4 October 2023 at 17:23:10 UTC+2 DSpace Technical Support 
> wrote:
>
>> Hi,
>>
>> At this time, DSpace 7 doesn't have Matomo support.  That said, I do know 
>> several other institutions/developers are interested in finding a way to 
>> support Matomo in DSpace 7.  See this ticket for more details: 
>> https://github.com/DSpace/DSpace/issues/8414   That ticket has also been 
>> highlighted to the OpenAIRE team that has built a prior Matomo plugin for 
>> DSpace in the past: 
>> https://github.com/openaire/OpenAIRE-Piwik-DSpace/issues/3
>>
>> Currently, this work is waiting on a volunteer to move it forward.  I 
>> agree that Matomo support should be added to DSpace, but the next step is 
>> to find a volunteer interested in making it happen.
>>
>> Tim
>>
>> On Thursday, September 28, 2023 at 5:16:02 AM UTC-5 sarfar...@gmail.com 
>> wrote:
>>
>>> Good Day
>>>
>>> I would like to know whats the process to setup Matomo on Dspace 7.5
>>> in Dspace 6 was included in :
>>>
>>> page-structure.xsl
>>>
>>> Which does not exist in Dspace 7.
>>>
>>> Any assistance would be appreciated.
>>>
>>> Thank you 
>>>
>>

-- 
All messages to this mailing list should adhere to the Code of Conduct: 
https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
--- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/9508d47d-5121-4c9a-9ddd-2ee3698e1335n%40googlegroups.com.

Reply via email to