SOL-217 Remove Google Analytics calls
This commit is contained in:
@@ -178,26 +178,3 @@ class CoursewareSearchIndexer(object):
|
||||
event_name,
|
||||
data
|
||||
)
|
||||
|
||||
try:
|
||||
if settings.FEATURES.get('SEGMENT_IO_LMS') and hasattr(settings, 'SEGMENT_IO_LMS_KEY'):
|
||||
# Google Analytics - log index content request
|
||||
import analytics
|
||||
|
||||
analytics.track(
|
||||
event_name,
|
||||
data,
|
||||
context={
|
||||
'Google Analytics': {
|
||||
'clientId': tracking_context.get('client_id')
|
||||
}
|
||||
}
|
||||
)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
# Capturing all exceptions thrown while tracking analytics events. We do not want
|
||||
# an operation to fail because of an analytics event, so we will capture these
|
||||
# errors in the logs.
|
||||
log.exception(
|
||||
u'Unable to emit %s event for content indexing.',
|
||||
event_name,
|
||||
)
|
||||
|
||||
@@ -32,6 +32,14 @@ define([
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Redirect to a URL. Mainly useful for mocking out in tests.
|
||||
* @param {string} url The URL to redirect to.
|
||||
*/
|
||||
redirect: function(url) {
|
||||
window.location.href = url;
|
||||
},
|
||||
|
||||
logSearchItem: function(event) {
|
||||
event.preventDefault();
|
||||
var target = this.model.id;
|
||||
@@ -47,13 +55,7 @@ define([
|
||||
"result_position": (page * pageSize + index),
|
||||
"result_link": target
|
||||
});
|
||||
window.analytics.track('"edx.course.search.result_selected"', {
|
||||
category: 'courseware_search',
|
||||
search_term: searchTerm,
|
||||
result_position: (page * pageSize + index),
|
||||
result_link: target
|
||||
});
|
||||
window.location.href = link;
|
||||
this.redirect(link);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -117,6 +117,18 @@ define([
|
||||
expect(this.item.$el).toContainHtml(breadcrumbs);
|
||||
});
|
||||
|
||||
it('log request on follow item link', function () {
|
||||
this.model.collection = new SearchCollection([this.model], { course_id: 'edx101' });
|
||||
this.item.render();
|
||||
// Mock the redirect call
|
||||
spyOn(this.item, 'redirect').andCallFake( function() {} );
|
||||
spyOn(this.item, 'logSearchItem').andCallThrough();
|
||||
var link = this.item.$el.find('a');
|
||||
expect(link.length).toBe(1);
|
||||
link.trigger('click');
|
||||
expect(this.item.redirect).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user