From 63f57fbc12db9821687969ce4346359f8afa8cf8 Mon Sep 17 00:00:00 2001
From: Cotes Chung <11371340+cotes2020@users.noreply.github.com>
Date: Thu, 10 Dec 2020 23:57:00 +0800
Subject: [PATCH] Delay GA loading
---
_includes/google-analytics.html | 14 ++++++++------
_includes/js-selector.html | 6 ++++++
_layouts/default.html | 4 ----
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/_includes/google-analytics.html b/_includes/google-analytics.html
index 74bbc87..b397265 100644
--- a/_includes/google-analytics.html
+++ b/_includes/google-analytics.html
@@ -6,11 +6,13 @@
MIT License
-->
-
+
diff --git a/_includes/js-selector.html b/_includes/js-selector.html
index b02e076..1fd6b9e 100644
--- a/_includes/js-selector.html
+++ b/_includes/js-selector.html
@@ -25,4 +25,10 @@
{% if jekyll.environment == 'production' %}
+
+
+ {% if site.google_analytics.id %}
+ {% include google-analytics.html %}
+ {% endif %}
+
{% endif %}
diff --git a/_layouts/default.html b/_layouts/default.html
index ad98149..4dc9dce 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -52,10 +52,6 @@ layout: compress
{% include search-loader.html %}
- {% if site.google_analytics.id and jekyll.environment == 'production' %}
- {% include google-analytics.html %}
- {% endif %}
-