Skip to content
This repository has been archived by the owner on Jan 31, 2018. It is now read-only.

Commit

Permalink
Merge pull request #593 from willkg/version-fix
Browse files Browse the repository at this point in the history
[bug 1169261] Fix event tracking
  • Loading branch information
willkg committed Jun 3, 2015
2 parents 004af6f + 6fcf93b commit f1398a5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions fjord/suggest/providers/sumosuggest.py
Expand Up @@ -14,7 +14,9 @@
# suggestions.
PROVIDER_VERSION = 1

EVENT_CATEGORY = 'sumo_suggest'
# Append provider version so that if we change the algorithm, we
# increment the version and then we can compare the two flows.
EVENT_CATEGORY = 'sumo_suggest' + str(PROVIDER_VERSION)

SUMO_HOST = 'https://support.mozilla.org'
SUMO_SUGGEST_API_URL = SUMO_HOST + '/api/2/search/suggest/'
Expand Down Expand Up @@ -124,7 +126,7 @@ def handle_redirect(self, request, redirect):
'ec': EVENT_CATEGORY,
'ea': 'view' if rank != 'aaq' else 'viewaaq',
'el': url
})
}, async=True)

return url

Expand Down Expand Up @@ -194,11 +196,13 @@ def get_suggestions(self, feedback, request=None):
logger.exception('SUMO Suggest API raised exception.')
return []

# Note: This needs to be synchronous so that "suggest" events
# come before their respective "view*" events.
ga_track_event({
'cid': str(feedback.id),
'ec': EVENT_CATEGORY,
'ea': 'suggest'
})
}, async=False)

links = self.docs_to_links(docs)

Expand Down

0 comments on commit f1398a5

Please sign in to comment.