From 05b4a0680d92717f5b1c79ab1e442e3ea0977898 Mon Sep 17 00:00:00 2001 From: "Chris K.Y. FUNG" <8746768+chriskyfung@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:50:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=94=A7=20chore(config):=20update=20Go?= =?UTF-8?q?ogle=20Analytics=20to=20use=20GA4=20Measurement=20ID=20in=20exa?= =?UTF-8?q?mple=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config-examples/project-page/_config.yml | 2 +- _config-examples/user-page/_config.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_config-examples/project-page/_config.yml b/_config-examples/project-page/_config.yml index 6cb837bb..dc6ed6b7 100644 --- a/_config-examples/project-page/_config.yml +++ b/_config-examples/project-page/_config.yml @@ -54,7 +54,7 @@ amp_disqus: cse_id: 011006674894885990812:tjln7k0nyjx # Analytics -google_analytics: 'UA-72575541-9' # Google Analytics Tracking ID +ga4: 'G-HP4LN87NJE' # Google Analytics 4 Measurement ID gtm: 'GTM-WQMQK3X' # Google Tag Manager ID # Google Ads diff --git a/_config-examples/user-page/_config.yml b/_config-examples/user-page/_config.yml index 06d72e0a..29caea70 100644 --- a/_config-examples/user-page/_config.yml +++ b/_config-examples/user-page/_config.yml @@ -28,7 +28,7 @@ amp_disqus: cse_id: 011006674894885990812:tjln7k0nyjx # Analytics -google_analytics: 'UA-72575541-9' # Google Analytics Tracking ID +ga4: 'G-HP4LN87NJE' # Google Analytics 4 Measurement ID gtm: 'GTM-WQMQK3X' # Google Tag Manager ID # Google Ads From 5ea939477afe84262fa4ecb0936a49678d2cd9a5 Mon Sep 17 00:00:00 2001 From: "Chris K.Y. FUNG" <8746768+chriskyfung@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:57:04 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=9B=A0=20refactor(analytics):=20updat?= =?UTF-8?q?e=20conditional=20logic=20and=20remove=20outdated=20configurati?= =?UTF-8?q?ons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Corrected conditional check for `site.ga4` in `postproc-content.html` - Removed outdated Google Analytics configuration in `youtube.html` - Removed outdated Google Analytics configuration in `default.html` Fixes #57 --- _includes/blocks/postproc-content.html | 6 +-- _includes/youtube.html | 53 -------------------------- _layouts/default.html | 32 ---------------- 3 files changed, 3 insertions(+), 88 deletions(-) diff --git a/_includes/blocks/postproc-content.html b/_includes/blocks/postproc-content.html index 76ceaa64..e95d0d57 100644 --- a/_includes/blocks/postproc-content.html +++ b/_includes/blocks/postproc-content.html @@ -1,9 +1,9 @@ {%- comment -%} Modify every link with an external URL with the followings: -- If `site.google_analytics` or `or site.ga4` is configured, add the attribute `data-vars-event-label` to the anchor tag for using AMP Google Analytics to track outbound link events +- If `site.ga4` is configured, add the attribute `data-vars-event-label` to the anchor tag for using Google Analytics 4 for AMP to track outbound link events - If `site.target_blank` is configured, add rel="noopener noreferrer" and target="_blank" to the anchor tag {%- endcomment -%} -{%- if site.google_analytics or site.ga4 or site.target_blank == true -%} +{%- if site.ga4 or site.target_blank == true -%} {%- assign splited_by_a = page.content | split: '' -%} {%- assign a_inner = a_inner | append: '>' -%} {%- endif -%} - {%- if site.google_analytics or site.ga4 -%} + {%- if site.ga4 -%} {%- assign event_label = 'data-vars-event-label="' | append: a_href | append: '" ' -%} {%- endif -%} {%- if site.target_blank == true -%} diff --git a/_includes/youtube.html b/_includes/youtube.html index 9c9dd106..b7ae9c46 100644 --- a/_includes/youtube.html +++ b/_includes/youtube.html @@ -18,59 +18,6 @@ {% capture label %}youtu.be/{{ include.id }}{% endcapture %} {%- endif -%} -{%- if site.google_analytics -%} -{{ include.indent }} - - {{ include.indent }} -{%- endif -%} {%- if site.ga4 -%} {{ include.indent }}Footer - {%- if site.google_analytics -%} - - - - - {%- endif -%} {%- if site.ga4 -%}