mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-01 02:41:39 -05:00
Attached member identity to analytic events
refs https://github.com/TryGhost/Team/issues/1062 - adds member identity to view events to attach member metadata on event
This commit is contained in:
parent
1c40c211f5
commit
5dff014c25
2 changed files with 6 additions and 5 deletions
|
@ -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()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue