diff --git a/README.md b/README.md index 99b3a24..59a94c9 100644 --- a/README.md +++ b/README.md @@ -78,11 +78,11 @@ Branch filter prod Authorization Header generate a safe string using : openssl rand -base64 32 ``` -4. Setup Matomo tracking +4. Setup Umami tracking -Add a new website to track from the Matomo interface as an admin user +Add a new website to track from the Umami interface as an admin user -All website → Add a new Website → Website +Settings → Add Website ## Ref diff --git a/assets/matomo-plugin.client.js b/assets/matomo-plugin.client.js deleted file mode 100644 index 9fabcf4..0000000 --- a/assets/matomo-plugin.client.js +++ /dev/null @@ -1,19 +0,0 @@ -// https://romangeber.com/blog/tech/nuxt3_matomo_integration - -import VueMatomo from "vue-matomo"; - -export default defineNuxtPlugin((nuxtApp) => { - nuxtApp.vueApp.use(VueMatomo, { - debug: false, - host: '', - siteId: 0, - router: nuxtApp.$router, - enableHeartBeatTimer: true, - heartBeatTimerInterval: 5, - enableLinkTracking: true, - requireConsent: false, - trackInitialView: true, - disableCookies: true, - requireCookieConsent: false, - }); -}); \ No newline at end of file diff --git a/bin/setup_matomo.sh b/bin/setup_matomo.sh deleted file mode 100644 index 1a86619..0000000 --- a/bin/setup_matomo.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/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" \ No newline at end of file diff --git a/bin/setup_umami.sh b/bin/setup_umami.sh new file mode 100644 index 0000000..d9bb89e --- /dev/null +++ b/bin/setup_umami.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +echo -e "${PURPLE}${BOLD}Add a new website to track from the Umami interface as an admin user${RESET}" +echo -e "${PURPLE}${BOLD}Settings → Add Website${RESET}" +echo -e "${PURPLE}${BOLD}Enter the Umami instance URL :${RESET}" +echo -e "${PURPLE} ie : umami.example.com${RESET}" +read umami_url +echo -e "${PURPLE}${BOLD}Enter the Website ID :${RESET}" +read umami_website_id + +script_snippet="head: { + script: [ + { + src: 'https://$umami_url', + defer: true, + 'data-website-id': '$umami_website_id' + } + ] +}" + +if ! grep -q "$script_snippet" nuxt.config.ts; then + if grep -q "app: {" nuxt.config.ts; then + sed -i "/app: {/a \ $script_snippet" nuxt.config.ts + else + sed -i '$d' nuxt.config.ts + echo "app: { + $script_snippet + } + })" >> nuxt.config.ts + fi +fi diff --git a/install.sh b/install.sh index b3c766e..51388fd 100644 --- a/install.sh +++ b/install.sh @@ -8,9 +8,9 @@ ## CADDYFILE EN JSON ## MÀJ ## reboot a running system -## MATOMO -## NODE EXPORTER ## setup webhook : get auth header +## EMAIL CAMPAIGN +## https://docs.directus.io/guides/extensions/operations-bulk-email-sendgrid.html . bin/functions.sh . bin/variables.sh @@ -118,10 +118,10 @@ read answer if [[ "$answer" == "y" ]]; then . bin/install_nuxt_front.sh - echo -e "${PURPLE}${BOLD}Track with Matomo ? (y/N) ${RESET}" + echo -e "${PURPLE}${BOLD}Track with Umami ? (y/N) ${RESET}" read answer if [[ "$answer" == "y" ]]; then - . bin/setup_matomo.sh + . bin/setup_umami.sh fi . bin/generate_static_front.sh @@ -131,4 +131,4 @@ if [[ "$answer" == "y" ]]; then if [[ "$answer" == "y" ]]; then . bin/setup_webhook.sh fi -fi \ No newline at end of file +fi