Skip to content

Cookie consent shows analytics usage also when GA is disabled#1816

Merged
tdonohue merged 12 commits intoDSpace:mainfrom
4Science:CST-6565
Sep 16, 2022
Merged

Cookie consent shows analytics usage also when GA is disabled#1816
tdonohue merged 12 commits intoDSpace:mainfrom
4Science:CST-6565

Conversation

@vins01-4science
Copy link
Copy Markdown
Contributor

References

Description

This PR hides the analytics accordion when the api-key is not configured or is left blank on the server-side

Instructions for Reviewers

You can check this PR by changing the property field google.analytics.key inside the dspace.cfg configuration file.
The expected behaviour for google.analytics.key value is:

  • Empty or null: Hide the section analytics inside the cookie consent popup
  • Other values: Show the section analytics inside the cookie consent popup

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes TSLint validation using yarn run lint
  • My PR doesn't introduce circular dependencies
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • If my PR includes new, third-party dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.

Sufiyan Shaikh and others added 9 commits August 9, 2022 15:10
# Conflicts:
#	src/app/shared/cookies/browser-klaro.service.ts
ref:
    - refactored property loading and mapping
    - refactored klaro initialisation
fix:
    - now initialisation waits for google-analytics api keys.
… CST-6565

� Conflicts:
�	src/app/shared/cookies/browser-klaro.service.ts
Copy link
Copy Markdown
Member

@ybnd ybnd left a comment

Choose a reason for hiding this comment

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

Functionally everything looks good to me, I've mainly listed some refactoring suggestions

Comment thread src/app/shared/cookies/browser-klaro.service.ts Outdated
Comment thread src/app/shared/cookies/browser-klaro.service.ts Outdated
Comment thread src/app/shared/cookies/browser-klaro.service.ts Outdated
Comment thread src/app/shared/cookies/browser-klaro.service.spec.ts
@vins01-4science
Copy link
Copy Markdown
Contributor Author

Hi @ybnd,

Firstly, thank you for the review.

I'm sorry but I have some doubt about your review, could you clarify them? I left some comment above.

Thank you!

Test:
    - New tests for the use case of filtering analytics configuration;
    - Enhanced initialization of service with new google analytics service mock.
@vins01-4science
Copy link
Copy Markdown
Contributor Author

Hi @ybnd,

refactored as you told me, and added some tests for the google analytics case.

Thank you!

Copy link
Copy Markdown
Member

@ybnd ybnd left a comment

Choose a reason for hiding this comment

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

Thanks for the refactor!
I've added a few more remarks for the specs

Comment thread src/app/shared/cookies/browser-klaro.service.spec.ts
Comment thread src/app/shared/cookies/browser-klaro.service.spec.ts Outdated
Comment thread src/app/shared/cookies/browser-klaro.service.spec.ts Outdated
@tdonohue tdonohue self-requested a review September 15, 2022 15:04
@vins01-4science
Copy link
Copy Markdown
Contributor Author

Hi @ybnd,

Thank You for the review, I refactored and cleaned the specs as You told me.

Copy link
Copy Markdown
Member

@ybnd ybnd left a comment

Choose a reason for hiding this comment

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

Thanks, the specs look good now!

Comment thread src/app/shared/cookies/browser-klaro.service.spec.ts Outdated
Copy link
Copy Markdown
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

👍 Thanks @vins01-4science ! The code looks good. I also tested this locally and verified that the Google Analytics section of the Klaro popup only appears when google.analytics.key is set on the backend.

@tdonohue tdonohue added this to the 7.4 milestone Sep 16, 2022
@tdonohue tdonohue merged commit 2a35329 into DSpace:main Sep 16, 2022
4science-it pushed a commit to 4Science/dspace-angular that referenced this pull request Jun 25, 2024
Task/dspace cris 2023 02 x/DSC-1745

Approved-by: Andrea Barbasso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cookie consent shows analytics usage also when GA is disabled

4 participants