diff --git a/README.md b/README.md index 6cea4fd42cb69c3deb66fff8587d69b5724dfa80..482efd1764f18df8236b46c0b8f888f91c6e071d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Install dependencies - pip install -r /requirements/docs.txt + pip install -r ./requirements/docs.txt ## Commands @@ -59,6 +59,7 @@ nav: - Ecogesture: ecolyo/functionalities/ecogesture.md - Feedback: ecolyo/functionalities/feedback.md - Initialization: ecolyo/functionalities/initialization.md + - Matomo: ecolyo/functionalities/matomo.md - Onboarding: ecolyo/functionalities/onboarding.md - Price Calculation: ecolyo/functionalities/prices_calculation.md - Profile Type: ecolyo/functionalities/profile_type.md diff --git a/docs/ecolyo/functionalities/matomo.md b/docs/ecolyo/functionalities/matomo.md new file mode 100644 index 0000000000000000000000000000000000000000..df0c556fd736611ace26f9a8b1650ff0fee318f6 --- /dev/null +++ b/docs/ecolyo/functionalities/matomo.md @@ -0,0 +1,73 @@ +# Matomo + +Matomo is implemented on ecolyo to anonymously track user's navigation and their devices so we understand better how our users use the app. + +## Hosting + +Matomo is hosted on [statweb.com](https://statweb.grandlyon.com/) where two projects are available : + +- PROD for live ecolyo apps + +!!! Work in progress + Prod is not yet enabled in live Ecolyo apps. More development and privacy adjustments are needed. + +- REC for every alpha instance + +_For our development, every alpha instance points to the REC project. That way, we work in an environment that is close to our production one._ + +## Local testing + +### Matomo server + +Matomo is disabled by default on local development to optimize performances. To develop specific features related to matomo withtout having to deploy to alpha, follow theses instructions. + +```bash +cd docker +docker-compose -f docker-compose.matomo.yml up -d +``` + +Now visit matomo at [localhost://9800/index.php](http://localhost:9800/index.php) and follow the given instructions to setup your matomo. + +On step 5, create a super user with the credentials you want, for example + +!!! info "" + ``` + root + Testtest1 + ``` + +On step6, enter dummy values and select a time zone. + +Once you finish the setup and access the server, you should see a warning telling you that matomo has not been configured with the correct port. To fix this problem follow these instrcutions. +``` +docker ps +# copy container id of matomo + +docker exec -it [containerID] bash + +# Install vi +apt-get update +apt-get install vim + +# Edit config.ini.php +vi config/config.ini.php +``` + +and under "[General]" add the port **9800** to the following line : +``` +trusted_hosts[] = "localhost:9800" +``` + +After reloading, you should be able to login. We need to make one last change for our app to send data to our matomo server. + +### Ecoloy app +In the file +src/targets/browser/**index.tsx** at line 66 comment the dev condition that is preventing the tracker from being initialized. +```jsx + if ( + window.Piwik + // && !isDev + ) { +``` + +When you navigate inside the Ecolyo app, in the network tab you should see requests to our matomo server 🎉🎉🎉 diff --git a/mkdocs.yml b/mkdocs.yml index 78404ed2d4314dc1a47439d8747a6a25d88f3aa8..e7be01c6fe687cd0d883cb543b38dcdfab223eb1 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -84,6 +84,7 @@ nav: - Ecogesture: ecolyo/functionalities/ecogesture.md - Feedback: ecolyo/functionalities/feedback.md - Initialization: ecolyo/functionalities/initialization.md + - Matomo: ecolyo/functionalities/matomo.md - Onboarding: ecolyo/functionalities/onboarding.md - Price Calculation: ecolyo/functionalities/prices_calculation.md - Profile Type: ecolyo/functionalities/profile_type.md