Skip to content

Commit 36b6086

Browse files
committed
GAタグを挿入する。
1 parent 5d3114e commit 36b6086

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- run: sh ./tm2scratch/add_ga_tracking_code.sh
3838
- run: NODE_OPTIONS=--openssl-legacy-provider npm run build
3939
- run: cp ./tm2scratch/favicon.ico ./build/static/favicon.ico
40-
40+
- run: sh ./tm2scratch/modify_index_html.sh
4141
- name: Setup Pages
4242
uses: actions/configure-pages@v4
4343
- name: Upload artifact

modify_index_html.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
LF=$(printf '\\\012_')
2+
LF=${LF%_}
3+
GA_TAG="\<title>TM2Scratch</title>${LF}\
4+
${LF}\
5+
<!-- Global site tag (gtag.js) - Google Analytics -->${LF}\
6+
<script async src=\"https://www.googletagmanager.com/gtag/js?id=UA-105345-36\"></script>${LF}\
7+
<script>${LF}\
8+
window.dataLayer = window.dataLayer \|\| [];${LF}\
9+
function gtag(){dataLayer.push(arguments);}${LF}\
10+
gtag('js', new Date());${LF}\
11+
${LF}\
12+
gtag('config', 'UA-105345-36');${LF}\
13+
</script>${LF}\
14+
"
15+
mv build/index.html build/index.html_orig
16+
sed -e "s|<title>Scratch 3.0 GUI</title>|${GA_TAG}|g" build/index.html_orig > build/index.html

0 commit comments

Comments
 (0)