#!/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