MOBILE-4367 courses: Log dashboard and my courses
parent
f670c6a9b9
commit
68b7a3ede9
|
@ -27,6 +27,7 @@ import { CoreBlockDelegate } from '@features/block/services/block-delegate';
|
|||
import { CoreTime } from '@singletons/time';
|
||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
|
||||
import { Translate } from '@singletons';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
|
||||
/**
|
||||
* Page that displays the dashboard page.
|
||||
|
@ -61,11 +62,13 @@ export class CoreCoursesDashboardPage implements OnInit, OnDestroy {
|
|||
}, CoreSites.getCurrentSiteId());
|
||||
|
||||
this.logView = CoreTime.once(async () => {
|
||||
await CoreUtils.ignoreErrors(CoreCourses.logView('dashboard'));
|
||||
|
||||
CoreAnalytics.logEvent({
|
||||
type: CoreAnalyticsEventType.VIEW_ITEM_LIST,
|
||||
type: CoreAnalyticsEventType.VIEW_ITEM,
|
||||
ws: 'core_my_view_page',
|
||||
name: Translate.instant('core.courses.mymoodle'),
|
||||
data: { category: 'course' },
|
||||
data: { category: 'course', page: 'dashboard' },
|
||||
url: '/my/',
|
||||
});
|
||||
});
|
||||
|
|
|
@ -79,11 +79,13 @@ export class CoreCoursesMyPage implements OnInit, OnDestroy, AsyncDirective {
|
|||
});
|
||||
|
||||
this.logView = CoreTime.once(async () => {
|
||||
await CoreUtils.ignoreErrors(CoreCourses.logView('my'));
|
||||
|
||||
CoreAnalytics.logEvent({
|
||||
type: CoreAnalyticsEventType.VIEW_ITEM_LIST,
|
||||
ws: 'core_enrol_get_users_courses',
|
||||
type: CoreAnalyticsEventType.VIEW_ITEM,
|
||||
ws: 'core_my_view_page',
|
||||
name: Translate.instant('core.courses.mycourses'),
|
||||
data: { category: 'course' },
|
||||
data: { category: 'course', page: 'my' },
|
||||
url: '/my/courses.php',
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1280,6 +1280,18 @@ export class CoreCoursesProvider {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Report a dashboard or my courses page view event.
|
||||
*
|
||||
* @param page Page to view.
|
||||
*/
|
||||
async logView(page: 'my' | 'dashboard'): Promise<void> {
|
||||
const site = CoreSites.getRequiredCurrentSite();
|
||||
const params: CoreMyViewPageWSParams = { page };
|
||||
|
||||
await site.write('core_my_view_page', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search courses.
|
||||
*
|
||||
|
@ -1928,3 +1940,10 @@ export type EnrolGuestValidatePasswordWSResponse = {
|
|||
hint?: string; // Password hint (if enabled)
|
||||
warnings?: CoreWSExternalWarning[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Params of core_my_view_page WS.
|
||||
*/
|
||||
type CoreMyViewPageWSParams = {
|
||||
page: 'my' | 'dashboard'; // My page to trigger a view event.
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue