From 4331a68a27012ad2df559b9150e7972d2c079d25 Mon Sep 17 00:00:00 2001 From: derekriemer Date: Fri, 21 Jul 2017 12:03:38 -0600 Subject: [PATCH] Fail gracefully if google anylitics fails to load, I.E. if an aggressive addblocker is in place. --- how.html | 18 +++++++++--------- when.html | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/how.html b/how.html index 6684bc4..5b00ccd 100644 --- a/how.html +++ b/how.html @@ -95,11 +95,11 @@ $('.generalGuidelinesMainImageLink').attr("href", imageLinkURL); //Google Analytics Event Tracking - General Guidelines - Opened - ga('send', { - hitType: 'event', - eventCategory: 'General Guidelines', - eventAction: 'Opened', - eventLabel: title + if(ga) ga('send', { + hitType: 'event', + eventCategory: 'General Guidelines', + eventAction: 'Opened', + eventLabel: title }); //IMAGE LINK @@ -158,13 +158,13 @@ $("#generalGuidelinesModalStep3DoneButton").show(); //Google Analytics Event Tracking - General Guidelines - Completed - ga('send', { + if(ga) ga('send', { hitType: 'event', eventCategory: 'General Guidelines', eventAction: 'Completed', eventLabel: title }); - + } else if (yourSelectionCorrect == "no") { $(".alert-danger").html(answer); $(".alert-danger").show(); @@ -291,7 +291,7 @@ $('.modalImageLink').html(viewLinkText); //Google Analytics Event Tracking - Specific Guidelines - Opened - ga('send', { + if(ga) ga('send', { hitType: 'event', eventCategory: 'Specific Guidelines', eventAction: 'Opened', @@ -726,7 +726,7 @@ $('#step3').show(); //Google Analytics Event Tracking - Specific Guidelines - Completed - ga('send', { + if(ga) ga('send', { hitType: 'event', eventCategory: 'Specific Guidelines', eventAction: 'Completed', diff --git a/when.html b/when.html index 33077c3..edb5f02 100644 --- a/when.html +++ b/when.html @@ -69,7 +69,7 @@ $('.modalImageLink').attr('href',imageLinkURL); //Google Analytics Event Tracking - When To Describe - Opened - ga('send', { + if(ga) ga('send', { hitType: 'event', eventCategory: 'When', eventAction: 'Opened',