#!/bin/bash echo -e "${PURPLE}${BOLD}Add a new website to track from the Matomo interface as an admin user${RESET}" echo -e "${PURPLE}${BOLD}All website → Add a new Website → Website${RESET}" echo -e "${PURPLE}${BOLD}Fill in the following informations :${RESET}" echo -e "${BLUE}${BOLD}Website name :${RESET}${BLUE}${DOMAIN_NAME}${RESET}" echo -e "${BLUE}${BOLD}Urls :${RESET}${BLUE}https://${DOMAIN_NAME}/${RESET}" echo -e "${PURPLE}${BOLD}Enter the Matomo instance URL :${RESET}${PURPLE} ie : matomo.example.com${RESET}" read -s matomo_url echo -e "${PURPLE}${BOLD}Find the website ID at the following URL${RESET}" echo -e "${PURPLE}https://${matomo_url}/index.php?module=SitesManager${RESET}" echo -e "${PURPLE}${BOLD}Enter the Website ID :${RESET}" read -s matomo_website_id get_username temp_matomo_script = /home/$username/matomo.html index_file = /var/www/html/public/index.html cp assets/matomo.html $temp_matomo_script sed -i "s/var matomoSiteId = '';/var matomoSiteId = '$matomo_website_id';/g" $temp_matomo_script sed -i "s/var matomoInstanceUrl = '';/var matomoInstanceUrl = '$matomo_url';/g" $temp_matomo_script sed -i '/<\/head>/i\'"$(cat $temp_matomo_script)"'' $index_file rm $temp_matomo_script