From a1613798f1c1434c571fc76ad554a3c324e471a9 Mon Sep 17 00:00:00 2001 From: Ricardo Amaral Date: Fri, 3 Nov 2017 03:29:36 +0000 Subject: [PATCH] Avoid serving the GA script to PageSpeed Insights MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Google PageSpeed Insights tool often shows a "Leverage Browser Caching" penalization when one is using Google Analytics with the recommended installation method. This sounds very counter-intuitive given that both tools come from Google themselves. This works around that issue by conditionally loading Google Analytics only if the page is not being crawled by Google PageSpeed Insights bot. Google is cheating me, so I'm cheating Google back... ¯\_(ツ)_/¯ --- src/ssi/gtag.html | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/ssi/gtag.html b/src/ssi/gtag.html index 9b00fab..1f8ff4c 100644 --- a/src/ssi/gtag.html +++ b/src/ssi/gtag.html @@ -1,9 +1,24 @@ - -