Ghost/ghost/admin/app/components/posts/analytics.hbs

171 lines
7.2 KiB
Handlebars

<section class="gh-canvas {{if (feature "audienceFeedback") "feature-audienceFeedback"}}" {{did-insert this.loadData}}>
<GhCanvasHeader class="gh-canvas-header gh-post-analytics-header">
<div class="flex flex-column flex-grow-1">
<div class="gh-canvas-breadcrumb">
<LinkTo @route="posts">
Posts
</LinkTo>
{{svg-jar "arrow-right-small"}}Analytics
</div>
<h2 class="gh-canvas-title gh-post-title">
{{this.post.title}}
</h2>
<div class="gh-post-analytics-meta">
<div class="gh-post-analytics-meta-text">
{{#if this.post.hasBeenEmailed }}
{{#if this.post.emailOnly}}
Sent
{{else}}
Published and sent
{{/if}}
{{else}}
Published
{{#if @post.didEmailFail}}
but failed to send
{{else}}
on your site
{{/if}}
{{/if}}
{{#let (moment-site-tz this.post.publishedAtUTC) as |publishedAt|}}
on
{{moment-format publishedAt "D MMM YYYY"}}
at
{{moment-format publishedAt "HH:mm"}}
{{/let}}
</div>
<LinkTo @route="editor.edit" @models={{array this.post.displayName this.post.id}} class="gh-post-list-cta edit" title="">
{{svg-jar "pen" title=""}}<span>Edit post</span>
</LinkTo>
</div>
</div>
</GhCanvasHeader>
<Tabs::Tabs class="gh-tabs-analytics" as |tabs|>
{{#if this.post.hasBeenEmailed}}
<tabs.tab>
<h3>Sent</h3>
<p>{{format-number this.post.email.emailCount}}</p>
</tabs.tab>
<tabs.tabPanel>
<Posts::PostActivityFeed
@postId={{this.post.id}}
@eventType="sent"
@linkQuery={{hash filterParam=(concat "emails.post_id:" this.post.id) }}
/>
</tabs.tabPanel>
{{#if this.post.showEmailOpenAnalytics }}
<tabs.tab>
<h3>Opened</h3>
<p>{{format-number this.post.email.openedCount}} <strong>{{this.post.email.openRate}}%</strong></p>
</tabs.tab>
<tabs.tabPanel>
<Posts::PostActivityFeed
@postId={{this.post.id}}
@eventType="opened"
@linkQuery={{hash filterParam=(concat "opened_emails.post_id:" this.post.id) }}
/>
</tabs.tabPanel>
{{/if}}
{{#if this.post.showEmailClickAnalytics }}
<tabs.tab>
<h3>Clicked</h3>
<p>{{format-number this.post.count.clicks}} <strong>{{this.post.clickRate}}%</strong></p>
</tabs.tab>
<tabs.tabPanel>
<Posts::PostActivityFeed
@postId={{this.post.id}}
@eventType="clicked"
@linkQuery={{hash filterParam=(concat "clicked_links.post_id:" this.post.id) }}
/>
</tabs.tabPanel>
{{/if}}
{{/if}}
{{#if this.post.showAudienceFeedback }}
<tabs.tab>
<h3>Positive feedback</h3>
<p>
{{format-number this.post.count.positive_feedback}}
{{!-- <strong>{{this.post.sentiment}}%</strong> --}}
</p>
</tabs.tab>
<tabs.tabPanel>
<Posts::PostActivityFeed
@postId={{this.post.id}}
@eventType="feedback"
@data={{array this.post.count.positive_feedback this.post.count.negative_feedback}}
@positiveLink={{hash filterParam=(concat "(feedback.post_id:" this.post.id "+feedback.score:1)")}}
@negativeLink={{hash filterParam=(concat "(feedback.post_id:" this.post.id "+feedback.score:0)")}}
/>
</tabs.tabPanel>
{{/if}}
{{#if this.post.showAttributionAnalytics }}
<tabs.tab>
<h3>{{gh-pluralize this.post.count.conversions "Conversions" without-count=true}}</h3>
<p>{{format-number this.post.count.conversions}}</p>
</tabs.tab>
<tabs.tabPanel>
<Posts::PostActivityFeed @postId={{this.post.id}} @eventType="conversion" />
</tabs.tabPanel>
{{/if}}
</Tabs::Tabs>
{{#if this.isLoaded }}
{{#if this.showLinks }}
{{#if (is-empty this.links) }}
{{!-- Empty state --}}
{{else}}
<Posts::LinksTable @links={{this.links}} @updateLink={{this.updateLink}} />
{{/if}}
{{/if}}
<div class="gh-post-analytics-box resources">
<a href="https://ghost.org/help/post-analytics/" target="_blank" class="gh-post-analytics-resource" rel="noopener noreferrer">
<div class="thumbnail" style="background-image: url(assets/img/marketing/analytics-1.jpg);"></div>
<div class="flex flex-column justify-between">
<div>
<h4 class="gh-main-section-header small bn">
Ghost help
</h4>
<div>
<h3>Understanding analytics in Ghost</h3>
<p>Find out how to review the performance of your content and get the most out of post analytics in Ghost.</p>
</div>
</div>
<div class="gh-btn gh-btn-link">Read more &rarr;</div>
</div>
</a>
<a href="https://ghost.org/resources/content-distribution/" target="_blank" class="gh-post-analytics-resource" rel="noopener noreferrer">
<div class="thumbnail" style="background-image: url(assets/img/marketing/analytics-2.jpg);"></div>
<div class="flex flex-column justify-between">
<div>
<h4 class="gh-main-section-header small bn">
Ghost resources
</h4>
<div>
<h3>How to get your content seen online</h3>
<p>Use these content distribution tactics to get more people to discover your work and increase engagement.</p>
</div>
</div>
<div class="gh-btn gh-btn-link">Read more &rarr;</div>
</div>
</a>
</div>
{{else}}
<div class="gh-post-analytics-loading">
<div class="gh-loading-spinner-outer">
<div class="gh-loading-spinner"></div>
</div>
</div>
{{/if}}
</section>