24 lines
1.2 KiB
Bash
24 lines
1.2 KiB
Bash
#!/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}"
|
|
echo -e "${PURPLE} ie : matomo.example.com${RESET}"
|
|
read matomo_url
|
|
echo -e "${PURPLE}${BOLD}Find the website ID at the following URL${RESET}"
|
|
echo -e "${BLUE}https://${matomo_url}/index.php?module=SitesManager${RESET}"
|
|
echo -e "${PURPLE}${BOLD}Enter the Website ID :${RESET}"
|
|
read matomo_website_id
|
|
|
|
mkdir -p ${FRONT_DIRECTORY}/plugins
|
|
cp assets/matomo-plugin.client.js ${FRONT_DIRECTORY}/plugins
|
|
chown -R www-data:www-data ${FRONT_DIRECTORY}/plugins
|
|
|
|
su -s /bin/bash -c "cd ${FRONT_DIRECTORY} &&\
|
|
npm install --save vue-matomo" www-data
|
|
|
|
sed -i "s/host: ''/host: 'https\:\/\/$matomo_url'/" "$FRONT_DIRECTORY/plugins/matomo-plugin.client.js"
|
|
sed -i "s/siteId: 0/siteId: $matomo_website_id/" "$FRONT_DIRECTORY/plugins/matomo-plugin.client.js" |