From 95c6b4d9f34990d4b6251afe7114ec89d6386700 Mon Sep 17 00:00:00 2001 From: Ryan L McIntyre Date: Sat, 27 Jul 2019 06:42:45 -0700 Subject: [PATCH] Adds tracking for glyph searches --- _includes/analytics.html | 6 ++++++ site.js | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/_includes/analytics.html b/_includes/analytics.html index 49f9671e1..d4446dc4e 100755 --- a/_includes/analytics.html +++ b/_includes/analytics.html @@ -1,4 +1,5 @@ {% if site.google_analytics_key %} + {% endif %} \ No newline at end of file diff --git a/site.js b/site.js index b795e70ea..ce00629ec 100644 --- a/site.js +++ b/site.js @@ -115,7 +115,14 @@ $(document).ready(function (){ // extremely basic search - $('#glyphSearch').on('keyup', searchGlyphs); + $('#glyphSearch').on('keyup', function(e) { + gtag('event', 'glyph-search', { + 'event_category': 'via-input', + 'event_label': 'Cheat Sheet', + 'value': e.target && e.target.value + }); + searchGlyphs(); + }); function searchGlyphs() { console.log('searching');