diff --git a/common/djangoapps/track/views/segmentio.py b/common/djangoapps/track/views/segmentio.py index 82aa2923752e..a61c5fdf5a5e 100644 --- a/common/djangoapps/track/views/segmentio.py +++ b/common/djangoapps/track/views/segmentio.py @@ -289,8 +289,8 @@ def send_event(request, method, **params): segment_key = helpers.get_current_site_configuration().get_secret_value('SEGMENT_KEY') if segment_key: data['writeKey'] = segment_key - data['messageId'] = 'ajs-' + uuid.uuid4().hex - site_response = requests.post(url, json=data) + data['messageId'] = 'ajs-next-' + uuid.uuid4().hex + site_response = requests.post(url, json=data) # noqa: F841 return HttpResponse( main_response.content, status=main_response.status_code, diff --git a/lms/templates/widgets/segment-io.html b/lms/templates/widgets/segment-io.html index 0e4f40ece203..5f8da23000e8 100644 --- a/lms/templates/widgets/segment-io.html +++ b/lms/templates/widgets/segment-io.html @@ -5,19 +5,25 @@ % if settings.LMS_SEGMENT_KEY and settings.LMS_SEGMENT_SITE: ## begin Copy from edx-platform/cms/templates/widgets/segment-io.html ## Appsembler: begin Segment Site - + return resource; + } + const { fetch: originalFetch } = window; + window.fetch = async (...args) => { + let [resource, config ] = args; + resource = replaceFetchResourceForSegmentSite(resource); + const response = await originalFetch(resource, config); + return response; + }; + }(); + ## Appsembler: end Segment Site ## end Copy % endif