Skip to content

UHF-10715: Add capability to test Matomo JS client#1192

Merged
jeremysteerio merged 4 commits intomainfrom
UHF-10715
Feb 17, 2025
Merged

UHF-10715: Add capability to test Matomo JS client#1192
jeremysteerio merged 4 commits intomainfrom
UHF-10715

Conversation

@jeremysteerio
Copy link
Contributor

@jeremysteerio jeremysteerio commented Feb 14, 2025

UHF-10715

Hard-code matomo script to use JS client for asuminen instance

How to install

  • Make sure your Asuminen instance is up and running on latest dev branch.
    • git pull origin dev
    • make fresh
  • Update the HDBT theme
    • composer require drupal/hdbt:dev-UHF-10715
  • Run make drush-cr

How to test

The script normally doesn't work locally, so make some changes:

  • cd into hdbt folder, run nvm use; npm i
  • Do these changes in the src/js/matomo.js file:
    • remove the Drupal.cookieConsent.getConsentStatus(['statistics']) condition on line 12
    • change the last line (69) of self calling function to window.matomoLoad = loadMatomoAnalytics; allowing you to call it from console
  • run npm run build
  • run make drush-cr
  • Open up https://helfi-asuminen.docker.so/fi/asuminen
  • Open up dev tools. Inspect head in the dom. Note that there are no scripts from digiaiiris domains
  • Call the load function in the dev console window.matomoLoad()
  • The should now be a script from digiaiiris domain at the top of the head
  • No errors should be produced during this operation

@github-actions
Copy link

✅ Tests passed! You can check the output here: https://city-of-helsinki.github.io/drupal-hdbt-visual-regression/pull/1192/html_report/

1 similar comment
@github-actions
Copy link

✅ Tests passed! You can check the output here: https://city-of-helsinki.github.io/drupal-hdbt-visual-regression/pull/1192/html_report/

Copy link
Contributor

@teroelonen teroelonen left a comment

Choose a reason for hiding this comment

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

This worked nicely 🦖

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.

2 participants