forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 2
VSB-TUO/Disable matomo statistics #1000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
926aa79
added configuration about disability of matomo statistics
Paurikova2 fc18752
made doc more general, remove debug console
Paurikova2 c144f6b
prevent regression in runtime enablement
Paurikova2 fc45d29
fix docs, log only when it is not production
Paurikova2 6ffb29b
avoid void operator:
Paurikova2 72a7196
fix brealcrumbs test
Paurikova2 28f23a1
removed consol log, made info more important
Paurikova2 7b2474a
copilot review
Paurikova2 b2a2b66
added controls if host is defined
Paurikova2 eec6072
added debug info to console, fix logic about matomo disability
Paurikova2 044c41c
removed comments, fix error
Paurikova2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Matomo Statistics Configuration | ||
|
|
||
| ## Enable/Disable Matomo | ||
|
|
||
| ### To Disable Matomo (Default) | ||
| Edit `src/environments/environment.ts`: | ||
| ```typescript | ||
| matomo: { | ||
| enabled: false, | ||
| hostUrl: 'https://your-matomo-server.com/', | ||
| siteId: '1', | ||
| dimensionId: 1 | ||
| } | ||
| ``` | ||
|
|
||
| ### To Enable Matomo | ||
| Edit `src/environments/environment.ts`: | ||
| ```typescript | ||
| matomo: { | ||
| enabled: true, | ||
| hostUrl: 'https://your-matomo-server.com/', | ||
| siteId: '1', | ||
| dimensionId: 1 | ||
| } | ||
| ``` | ||
|
|
||
| ## Files to Modify | ||
|
|
||
| - **Development**: `src/environments/environment.ts` | ||
| - **Production**: `src/environments/environment.production.ts` | ||
| - **Global/Server-side**: `config/config.example.yml` (and `config/config.yml` in production) | ||
| - **Runtime (if applicable)**: `config.json` | ||
| > **Note:** The `enabled` flag for Matomo may be present in multiple configuration files. Ensure you update all relevant files (`environment.ts`, `environment.production.ts`, `config/config.example.yml`, and any runtime `config.json`) to avoid conflicts or unexpected behavior. | ||
|
|
||
| ## After Changes | ||
|
|
||
| 1. Restart the application | ||
| 2. Clear browser cache | ||
|
|
||
| When disabled: No Matomo scripts load, statistics page shows "disabled" message. | ||
| When enabled: Matomo tracking works normally. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -465,5 +465,6 @@ accessibility: | |
| cookieExpirationDuration: 7 | ||
|
|
||
| matomo: | ||
| enabled: false | ||
| hostUrl: http://localhost:8135/ | ||
| siteId: 1 | ||
98 changes: 52 additions & 46 deletions
98
src/app/item-page/clarin-matomo-statistics/clarin-matomo-statistics.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,50 +1,56 @@ | ||
| <div class="container"> | ||
| <div class="row px-2 py-2 rounded alert-info"> | ||
| <i class="fas fa-info-circle pt-1"></i> | ||
| <span class="pl-2">{{'item.matomo-statistics.info.message' | translate}}</span> | ||
| <div *ngIf="!matomoEnabled" class="row px-2 py-2 rounded alert-warning"> | ||
| <i class="fas fa-exclamation-triangle pt-1"></i> | ||
|
Paurikova2 marked this conversation as resolved.
Outdated
|
||
| <span class="pl-2">Matomo statistics are currently disabled.</span> | ||
| </div> | ||
| <div class="row pt-4 clarin-bottom-line"> | ||
| <button type="button" class="col-md-2 clarin-chart-button btn btn-outline-success justify-content-start py-2 px-3" | ||
| [ngClass]="viewsButtonClicked ? 'clarin-chart-views-clicked' : 'clarin-chart-views'" | ||
| role="button" | ||
| data-bs-toggle="button" | ||
| (click)="toggleViews()"> | ||
| <div class="align-items-center justify-content-center d-flex"><i class="far fa-eye"></i></div> | ||
| <div class="align-items-center justify-content-center d-flex">{{'item.page.matomo-statistics.views.button' | translate}}</div> | ||
| </button> | ||
| <button type="button" class="col-md-2 clarin-chart-button btn btn-outline-info py-2 px-3 ml-1" | ||
| [ngClass]="downloadsButtonClicked ? 'clarin-chart-downloads-clicked' : 'clarin-chart-downloads'" | ||
| data-bs-toggle="button" | ||
| (click)="toggleDownload()"> | ||
| <div class="align-items-center justify-content-center d-flex"><i class="far fa-eye"></i></div> | ||
| <div class="align-items-center justify-content-center d-flex">{{'item.page.matomo-statistics.downloads.button' | translate}}</div> | ||
| </button> | ||
| </div> | ||
| <div class="row pt-2 justify-content-end"> | ||
| <span class="chart-message rounded px-2 py-2">{{chartMessage}}</span> | ||
| <button class="btn clarin-btn-back rounded px-2 py-2 ml-2" *ngIf="!(this.actualPeriod === this.periodYear)" (click)="back()">Back</button> | ||
| </div> | ||
| <div class="chart pt-2"> | ||
| <canvas baseChart | ||
| [datasets]="chartLabels.datasets" | ||
| [labels]="chartLabels.labels" | ||
| [options]="chartOptions" | ||
| [legend]="false" | ||
| (chartClick)="chartClicked($event)" | ||
| chartType="line"> | ||
| </canvas> | ||
| </div> | ||
| <div *ngIf="downloadsButtonClicked" class="pt-3"> | ||
| <table class="table table-striped"> | ||
| <thead> | ||
| Filewise Statistics | ||
| </thead> | ||
| <tbody> | ||
| <tr *ngFor="let fileData of (filesDownloads | async) | dsKeys"> | ||
| <td><b>{{fileData.value}}</b></td> | ||
| <td>{{fileData.key}}</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| <div *ngIf="matomoEnabled"> | ||
| <div class="row px-2 py-2 rounded alert-info"> | ||
| <i class="fas fa-info-circle pt-1"></i> | ||
| <span class="pl-2">{{'item.matomo-statistics.info.message' | translate}}</span> | ||
| </div> | ||
| <div class="row pt-4 clarin-bottom-line"> | ||
| <button type="button" class="col-md-2 clarin-chart-button btn btn-outline-success justify-content-start py-2 px-3" | ||
| [ngClass]="viewsButtonClicked ? 'clarin-chart-views-clicked' : 'clarin-chart-views'" | ||
| role="button" | ||
| data-bs-toggle="button" | ||
| (click)="toggleViews()"> | ||
| <div class="align-items-center justify-content-center d-flex"><i class="far fa-eye"></i></div> | ||
| <div class="align-items-center justify-content-center d-flex">{{'item.page.matomo-statistics.views.button' | translate}}</div> | ||
| </button> | ||
| <button type="button" class="col-md-2 clarin-chart-button btn btn-outline-info py-2 px-3 ml-1" | ||
| [ngClass]="downloadsButtonClicked ? 'clarin-chart-downloads-clicked' : 'clarin-chart-downloads'" | ||
| data-bs-toggle="button" | ||
| (click)="toggleDownload()"> | ||
| <div class="align-items-center justify-content-center d-flex"><i class="far fa-eye"></i></div> | ||
| <div class="align-items-center justify-content-center d-flex">{{'item.page.matomo-statistics.downloads.button' | translate}}</div> | ||
| </button> | ||
| </div> | ||
| <div class="row pt-2 justify-content-end"> | ||
| <span class="chart-message rounded px-2 py-2">{{chartMessage}}</span> | ||
| <button class="btn clarin-btn-back rounded px-2 py-2 ml-2" *ngIf="!(this.actualPeriod === this.periodYear)" (click)="back()">Back</button> | ||
| </div> | ||
| <div class="chart pt-2"> | ||
| <canvas baseChart | ||
| [datasets]="chartLabels.datasets" | ||
| [labels]="chartLabels.labels" | ||
| [options]="chartOptions" | ||
| [legend]="false" | ||
| (chartClick)="chartClicked($event)" | ||
| chartType="line"> | ||
| </canvas> | ||
| </div> | ||
| <div *ngIf="downloadsButtonClicked" class="pt-3"> | ||
| <table class="table table-striped"> | ||
| <thead> | ||
| Filewise Statistics | ||
| </thead> | ||
| <tbody> | ||
| <tr *ngFor="let fileData of (filesDownloads | async) | dsKeys"> | ||
| <td><b>{{fileData.value}}</b></td> | ||
| <td>{{fileData.key}}</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
Paurikova2 marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.