diff --git a/pkg/controller/account/search.go b/pkg/controller/account/search.go index 229ff33..8d60b99 100644 --- a/pkg/controller/account/search.go +++ b/pkg/controller/account/search.go @@ -162,6 +162,15 @@ func Search() http.HandlerFunc { } } + // Log the search terms for analytics. + if searchTerm != "" { + message := "Searched the member directory by keyword: " + searchTerm + if restricted != nil { + message += " (which was restricted)" + } + models.LogEvent(currentUser, nil, models.ChangeLogAnalytics, "users.search", 0, message) + } + pager := &models.Pagination{ PerPage: config.PageSizeMemberSearch, Sort: sort, diff --git a/pkg/controller/forum/search.go b/pkg/controller/forum/search.go index acc06a4..da33ba3 100644 --- a/pkg/controller/forum/search.go +++ b/pkg/controller/forum/search.go @@ -109,6 +109,12 @@ func Search() http.HandlerFunc { log.Error("Couldn't MapCommentPhotos: %s", err) } + // Log the search terms for analytics. + if searchTerm != "" { + message := "Searched the forums by keyword: " + searchTerm + models.LogEvent(currentUser, nil, models.ChangeLogAnalytics, "forums.search", 0, message) + } + var vars = map[string]interface{}{ "CurrentForumTab": "search", "Pager": pager, diff --git a/pkg/models/change_log.go b/pkg/models/change_log.go index 0c21731..5f4096f 100644 --- a/pkg/models/change_log.go +++ b/pkg/models/change_log.go @@ -38,6 +38,7 @@ const ( ChangeLogBanned = "banned" ChangeLogAdmin = "admin" // admin status toggle ChangeLogLifecycle = "lifecycle" // de/reactivated accounts + ChangeLogAnalytics = "analytics" // misc analytics ) var ChangeLogEventTypes = []string{ @@ -49,6 +50,7 @@ var ChangeLogEventTypes = []string{ ChangeLogBanned, ChangeLogAdmin, ChangeLogLifecycle, + ChangeLogAnalytics, } // PaginateChangeLog lists the change logs.