From 608ff599c8b65e90a5592a8e91c483f15e3b3cb6 Mon Sep 17 00:00:00 2001
From: Paul Kaplan <pkaplan@media.mit.edu>
Date: Mon, 23 Jul 2018 11:22:00 -0400
Subject: [PATCH] Use pageview with query param for tracking search usage

This replaces the event-based search analytics because that method does not allow us to get the advantages of more search-specific analytics.
---
 src/components/library/library.jsx | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/components/library/library.jsx b/src/components/library/library.jsx
index 2da09f272..9d63fc3bf 100644
--- a/src/components/library/library.jsx
+++ b/src/components/library/library.jsx
@@ -62,12 +62,8 @@ class LibraryComponent extends React.Component {
         this.props.onItemSelected(this.getFilteredData()[id]);
     }
     handleClose () {
-        analytics.event({
-            category: 'library',
-            action: `${this.props.id}: close with search`,
-            label: this.state.filterQuery || '(empty)'
-        });
         this.props.onRequestClose();
+        analytics.pageview(`/${this.props.id}/search?q=${this.state.filterQuery}`);
     }
     handleTagClick (tag) {
         this.setState({
-- 
GitLab