matomo corrections 2

This commit is contained in:
Valentin 2024-05-13 01:57:18 +02:00
parent 957c1ba753
commit 65c9d0dfd1
1 changed files with 7 additions and 1 deletions

View File

@ -16,10 +16,16 @@ get_username
temp_matomo_script=/home/$username/matomo.html temp_matomo_script=/home/$username/matomo.html
index_file=/var/www/html/public/index.html index_file=/var/www/html/public/index.html
tmp_file=/home/$username/tmp_index
cp assets/matomo.html $temp_matomo_script 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 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 "s/var matomoInstanceUrl = '';/var matomoInstanceUrl = '$matomo_url';/g" $temp_matomo_script
sed -i '/<\/head>/i\'"$(cat $temp_matomo_script)"'' $index_file sed -i 's/<\/head>/\n<\/head>/' $index_file
line_number=$(grep -n '</head>' $index_file | cut -d':' -f1)
head -n $(($line_number - 1)) $index_file > $tmp_file
tail -n +$line_number $index_file >> $tmp_file
mv $tmp_file $index_file
rm $tmp_file