feat: add explicit courserun_key parameter to /event endpoint

We add 'courserun_key' (aka "course_id" though that's technically a
misnomer) as an optional parameter to the /event endpoint url. If it
is not present, it will still be parsed out of the url, if the url is
of the right format.

Additionally, Logger.log() in js adds this parameter to its /event
call, pulling it from the $$course_id global.

This provides opportunity for MFEs to (separately) provide the key
without concern about url parsing.

TNL-7752
This commit is contained in:
Ken Clary
2021-07-30 10:23:23 -04:00
committed by Ken Clary
parent af82c6270a
commit 8c8450f6dc
6 changed files with 69 additions and 10 deletions

View File

@@ -17,6 +17,7 @@
data: {
event_type: 'example',
event: '"data"',
courserun_key: 'edX/999/test',
page: window.location.href
},
async: true
@@ -32,6 +33,7 @@
data: {
event_type: 'example',
event: '"data"',
courserun_key: 'edX/999/test',
page: window.location.href
},
async: false
@@ -66,6 +68,7 @@
data: {
event_type: 'example',
event: '"data"',
courserun_key: 'edX/999/test',
page: window.location.href
},
async: true
@@ -83,6 +86,7 @@
data: {
event_type: 'example',
event: '"data"',
courserun_key: 'edX/999/test',
page: window.location.href
},
async: true
@@ -100,6 +104,7 @@
data: {
event_type: 'example',
event: '"data"',
courserun_key: 'edX/999/test',
page: window.location.href
},
async: true

View File

@@ -59,6 +59,7 @@
return sendRequest({
event_type: eventType,
event: JSON.stringify(data),
courserun_key: typeof $$course_id !== 'undefined' ? $$course_id : null,
page: window.location.href
}, requestOptions);
},