diff --git a/src/courseware/course/sequence/Unit/ContentIFrame.jsx b/src/courseware/course/sequence/Unit/ContentIFrame.jsx index 6d21c129b0..1e196f13b1 100644 --- a/src/courseware/course/sequence/Unit/ContentIFrame.jsx +++ b/src/courseware/course/sequence/Unit/ContentIFrame.jsx @@ -29,6 +29,7 @@ export const testIDs = StrictDict({ const ContentIFrame = ({ iframeUrl, + courseId, shouldShowContent, loadingMessage, id, @@ -46,6 +47,7 @@ const ContentIFrame = ({ id, iframeUrl, onLoaded, + courseId, }); const { @@ -124,6 +126,7 @@ ContentIFrame.propTypes = { elementId: PropTypes.string.isRequired, onLoaded: PropTypes.func, title: PropTypes.node.isRequired, + courseId: PropTypes.string.isRequired, }; ContentIFrame.defaultProps = { diff --git a/src/courseware/course/sequence/Unit/hooks/useIFrameBehavior.js b/src/courseware/course/sequence/Unit/hooks/useIFrameBehavior.js index 2dda5c2200..50ca33af5a 100644 --- a/src/courseware/course/sequence/Unit/hooks/useIFrameBehavior.js +++ b/src/courseware/course/sequence/Unit/hooks/useIFrameBehavior.js @@ -1,4 +1,5 @@ import { getConfig } from '@edx/frontend-platform'; +import { sendTrackEvent } from '@edx/frontend-platform/analytics'; import React from 'react'; import { useDispatch } from 'react-redux'; @@ -22,6 +23,7 @@ export const stateKeys = StrictDict({ const useIFrameBehavior = ({ elementId, id, + courseId, iframeUrl, onLoaded, }) => { @@ -94,6 +96,11 @@ const useIFrameBehavior = ({ const handleIFrameLoad = () => { if (!hasLoaded) { setShowError(true); + sendTrackEvent('edx.bi.error.learning.iframe_load_failed', { + iframeUrl, + unitId: id, + courseId, + }); logError('Unit iframe failed to load. Server possibly returned 4xx or 5xx response.', { iframeUrl, }); diff --git a/src/courseware/course/sequence/Unit/index.jsx b/src/courseware/course/sequence/Unit/index.jsx index b465375282..3b7e62433f 100644 --- a/src/courseware/course/sequence/Unit/index.jsx +++ b/src/courseware/course/sequence/Unit/index.jsx @@ -54,6 +54,7 @@ const Unit = ({