Skip to content
Snippets Groups Projects
matomo.md 1.86 KiB
Newer Older
  • Learn to ignore specific revisions
  • # 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
    - REC for every alpha instance
    
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    ## Local testing
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    Matomo is disabled by default on local development to optimize performances. To develop specific features related to matomo without 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
    
    
    
    On step6, enter dummy values and select a time zone.
    
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    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 instructions.
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    
    ```sh
    
    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 :
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    
    ```sh
    
    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.
    
    
    Hugo NOUTS's avatar
    Hugo NOUTS committed
    ### Ecolyo app
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    
    In the file
    
    src/targets/browser/**index.tsx** at line 66 comment the dev condition that is preventing the tracker from being initialized.
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    
    
    ```ts title="src/targets/browser/index.tsx"
    
      if (
        window.Piwik
        // && !isDev
      ) {
    ```
    
    When you navigate inside the Ecolyo app, in the network tab you should see requests to our matomo server 🎉🎉🎉