mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 14:43:08 +03:00
Wired up source to conversions on analytics page
refs https://github.com/TryGhost/Team/issues/2157 - The source links to the referrer url if there is any - A dash is used if no source is available
This commit is contained in:
parent
bd091c65c7
commit
fee493af45
@ -58,7 +58,15 @@
|
||||
</div>
|
||||
{{#if (eq this.eventType "conversion")}}
|
||||
<div class="gh-dashboard-list-item-sub">
|
||||
Source
|
||||
{{#if parsedEvent.source}}
|
||||
{{#if parsedEvent.source.url}}
|
||||
<a href={{parsedEvent.source.url}} rel="noopener noreferrer" target="_blank">{{parsedEvent.source.name}}</a>
|
||||
{{else}}
|
||||
<span>{{parsedEvent.source.name}}</span>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<span class="midlightgrey">—</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="gh-dashboard-list-item-sub">
|
||||
@ -150,4 +158,4 @@
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/let}}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -18,6 +18,7 @@ export default class ParseMemberEventHelper extends Helper {
|
||||
const object = this.getObject(event);
|
||||
const url = this.getURL(event);
|
||||
const timestamp = moment(event.data.created_at);
|
||||
const source = this.getSource(event);
|
||||
|
||||
return {
|
||||
memberId: event.data.member_id ?? event.data.member?.id,
|
||||
@ -29,6 +30,7 @@ export default class ParseMemberEventHelper extends Helper {
|
||||
action,
|
||||
join,
|
||||
object,
|
||||
source,
|
||||
info,
|
||||
description,
|
||||
url,
|
||||
@ -226,6 +228,20 @@ export default class ParseMemberEventHelper extends Helper {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Clickable object, shown between action and info, or in a separate column in some views
|
||||
*/
|
||||
getSource(event) {
|
||||
if (event.data?.attribution?.referrer_source) {
|
||||
return {
|
||||
name: event.data.attribution.referrer_source,
|
||||
url: event.data.attribution.referrer_url ?? null
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
getInfo(event) {
|
||||
if (event.type === 'subscription_event') {
|
||||
let mrrDelta = getNonDecimal(event.data.mrr_delta, event.data.currency);
|
||||
|
Loading…
Reference in New Issue
Block a user