Skip to content

Commit

Permalink
Add google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
SeeChen committed Nov 27, 2024
1 parent 27ba6d8 commit bfbba15
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
17 changes: 10 additions & 7 deletions JavaScript/General/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,13 @@ const routes = {
},

"/travel": async () => {
window.myData.travel.isCountry = false;
window.myData.travel.isProvice = false;
await routesFunction.travel();
},
"/travel/": async () => {
window.myData.travel.isCountry = false;
window.myData.travel.isProvice = false;
await routesFunction.travel();
},
"/travel/:countryId": async (
Expand All @@ -223,13 +227,10 @@ const routes = {

const { countryId } = params;

if (!myFunction.travelIsValid(countryId)) {

if (countryId === "TW") {
await router.route("/travel/CN/TaiWan", true);
return;
}
if (!(await myFunction.travelIsValid(countryId))) {

window.myData.travel.isCountry = false;
window.myData.travel.isProvice = false;
await myFunction.Page404();
return;
} else {
Expand All @@ -245,8 +246,10 @@ const routes = {
) => {
const { countryId, proviceId } = params;

if (!myFunction.travelIsValid(countryId, proviceId)) {
if (!(await myFunction.travelIsValid(countryId, proviceId))) {

window.myData.travel.isCountry = false;
window.myData.travel.isProvice = false;
await myFunction.Page404();
return;
} else {
Expand Down
9 changes: 9 additions & 0 deletions spa.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@
<script src = "/JavaScript/Travel/travel.js" type = "module"></script>

<script src = "/JavaScript/Lens/lens.js" type = "module"></script>

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-C522VVXBTT"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-C522VVXBTT');
</script>
</head>

<body>
Expand Down

0 comments on commit bfbba15

Please sign in to comment.