diff --git a/ghost/portal/src/analytics.js b/ghost/portal/src/analytics.js index db921b37dc..7529085ccf 100644 --- a/ghost/portal/src/analytics.js +++ b/ghost/portal/src/analytics.js @@ -3,11 +3,10 @@ import setupGhostApi from './utils/api'; function sendEntryViewEvent({analyticsId, api}) { if (analyticsId) { api.analytics.pushEvent({ - event_name: 'entry_view', - member_id: '', - member_status: '', + type: 'entry_view', entry_id: analyticsId, - source_url: window.location.href + source_url: window.location.href, + created_at: new Date() }); } } diff --git a/ghost/portal/src/utils/api.js b/ghost/portal/src/utils/api.js index e27fc8f8e5..4f225ed176 100644 --- a/ghost/portal/src/utils/api.js +++ b/ghost/portal/src/utils/api.js @@ -19,8 +19,10 @@ function setupGhostApi({siteUrl = window.location.origin}) { const api = {}; api.analytics = { - pushEvent(event) { + async pushEvent(event) { const url = endpointFor({type: 'members', resource: 'events'}); + const identity = await api.member.identity(); + event.identity = identity; const body = { events: [event] };