-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Expand file tree
/
Copy pathlist-item-analytics.hbs
More file actions
356 lines (340 loc) · 18.3 KB
/
Copy pathlist-item-analytics.hbs
File metadata and controls
356 lines (340 loc) · 18.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
{{!-- template-lint-disable no-invalid-interactive --}}
<li class="gh-list-row gh-posts-list-item gh-post-list-plain-status gh-post-list-analytics"
data-testid="posts-list-item"
{{on "mouseover" this.mouseOver}}
{{on "mouseleave" this.mouseLeave}}
...attributes
>
{{!-- Title column --}}
{{#if (and this.session.user.isContributor @post.isPublished)}}
<a href={{@post.url}} class="permalink gh-list-data gh-post-list-title gh-post-with-feature-image" target="_blank" rel="noopener noreferrer">
<div class="gh-post-list-feature-image" style={{html-safe (concat "background-image: url(" @post.featureImage ");")}}>
{{#unless @post.featureImage}}
<div class="gh-post-list-feature-image-placeholder">
{{svg-jar "post-feature-image-placeholder"}}
</div>
{{/unless}}
</div>
<div class="gh-post-list-title-content">
<h3 class="gh-content-entry-title">
{{@post.title}}
</h3>
{{#unless @hideAuthor }}
<p class="gh-content-entry-meta">
<span class="gh-content-entry-author">
By {{post-author-names @post}}
{{#if @post.primaryTag}}
in <span class="midgrey-l2 fw5">{{@post.primaryTag.name}}</span>
{{/if}}
-
</span>
{{#if (or @post.isDraft @post.isScheduled)}}
<span class="gh-content-entry-date" title="Updated {{gh-format-post-time @post.updatedAtUTC absolute=true}}">
{{gh-format-post-time @post.updatedAtUTC absolute=true short=true}}
</span>
{{else}}
<span class="gh-content-entry-date" title="Published {{gh-format-post-time @post.publishedAtUTC absolute=true}}">
{{gh-format-post-time @post.publishedAtUTC absolute=true short=true}}
</span>
{{/if}}
</p>
<p class="gh-content-entry-status" data-test-editor-post-status>
<span class="published">
Published
{{#if @post.hasEmail}}
{{#if this.isHovered}}
and sent to {{gh-pluralize @post.email.emailCount "member"}}
{{else}}
and sent
{{/if}}
{{/if}}
</span>
</p>
{{/unless}}
</div>
</a>
{{else}}
<LinkTo @route="lexical-editor.edit" @models={{array this.post.displayName this.post.id}} class="permalink gh-list-data gh-post-list-title gh-post-with-feature-image">
<div class="gh-post-list-feature-image" style={{html-safe (concat "background-image: url(" @post.featureImage ");")}}>
{{!-- Fallback to placeholder --}}
{{#unless @post.featureImage}}
<div class="gh-post-list-feature-image-placeholder">
{{svg-jar "post-feature-image-placeholder"}}
</div>
{{/unless}}
</div>
<div class="gh-post-list-title-content">
<h3 class="gh-content-entry-title">
{{#if @post.featured}}
{{svg-jar "star-fill" class="gh-featured-post"}}
{{/if}}
{{@post.title}}
{{! Display lexical/mobiledoc indicators for easier testing of the feature --}}
{{#if (feature 'lexicalIndicators')}}
{{#if @post.lexical}}
<span class="gh-lexical-indicator">L</span>
{{else if @post.mobiledoc}}
<span class="gh-lexical-indicator">M</span>
{{/if}}
{{/if}}
</h3>
{{#unless @hideAuthor }}
<p class="gh-content-entry-meta">
<span class="gh-content-entry-author">
By {{post-author-names @post}}
{{#if @post.primaryTag}}
in <span class="midgrey-l2 fw5">{{@post.primaryTag.name}}</span>
{{/if}}
-
</span>
{{#if (or @post.isDraft @post.isScheduled)}}
<span class="gh-content-entry-date" title="Updated {{gh-format-post-time @post.updatedAtUTC absolute=true}}">
{{gh-format-post-time @post.updatedAtUTC absolute=true short=true}}
</span>
{{else}}
<span class="gh-content-entry-date" title="Published {{gh-format-post-time @post.publishedAtUTC absolute=true}}">
{{gh-format-post-time @post.publishedAtUTC absolute=true short=true}}
</span>
{{/if}}
{{!-- {{#if @post.lexical}}
<span class="gh-content-entry-date">– Lexical</span>
{{/if}} --}}
</p>
<p class="gh-content-entry-status" data-test-editor-post-status>
{{#if @post.isScheduled}}
<span class="scheduled">
Scheduled
{{#if this.isHovered}}
<span class="schedule-details" {{css-transition "anim-fade-in-scale"}}>
{{#if @post.emailOnly}}
to be sent
{{this.scheduledText}} to {{humanize-recipient-filter @post.emailSegment}}
{{else}}
to be published {{if @post.newsletter "and sent "}}
{{this.scheduledText}}
{{#if @post.newsletter}}
to {{humanize-recipient-filter @post.emailSegment}}
{{/if}}
{{/if}}
</span>
{{/if}}
</span>
{{/if}}
{{#if @post.isDraft}}
<span class="draft">
Draft
</span>
{{/if}}
{{#if @post.isPublished}}
<span class="published {{this.errorClass}}">
Published
{{#if @post.didEmailFail}}
but failed to send newsletter
{{else if @post.hasBeenEmailed}}
and sent
{{#if this.isHovered}}
<span {{css-transition "anim-fade-in-scale"}}>to {{gh-pluralize @post.email.emailCount "member"}}</span>
{{/if}}
{{/if}}
</span>
{{/if}}
{{#if @post.isSent}}
<span class="sent {{this.errorClass}}">
{{#if @post.didEmailFail}}
Failed to send newsletter
{{else}}
Sent
{{#if this.isHovered}}
<span {{css-transition "anim-fade-in-scale"}}>to {{gh-pluralize @post.email.emailCount "member"}}</span>
{{/if}}
{{/if}}
</span>
{{/if}}
</p>
{{/unless}}
</div>
</LinkTo>
{{/if}}
{{!-- Metrics columns wrapper --}}
<div class="gh-post-list-analytics-right">
<div class="gh-post-list-metrics-container">
{{!-- Visitor count column (only when web analytics is enabled) --}}
{{#if this.settings.webAnalyticsEnabled}}
{{#if @post.isPublished}}
<a href="#/posts/analytics/{{@post.id}}/web" class="permalink gh-list-data gh-post-list-metrics gh-post-list-analytics-tt-container">
<div class="gh-post-list-analytics-tooltip {{this.tooltipPosition}}">
<h3>Web traffic</h3>
<div class="metrics">
<div class="metric">
<div class="data">
{{svg-jar "analytics-visitors"}}
Unique visitors
</div>
<span>
{{#if this.hasVisitorData}}
{{format-number this.visitorCount}}
{{else}}
0
{{/if}}
</span>
</div>
</div>
</div>
<div class="gh-post-list-analytics-metric" data-test-analytics-visitors>
{{svg-jar "analytics-visitors" class="gh-list-analytics-icon"}}
<span class="gh-content-email-stats-value">
{{#if this.hasVisitorData}}
{{abbreviate-number this.visitorCount}}
{{else}}
0
{{/if}}
</span>
</div>
</a>
{{/if}}
{{/if}}
{{#if @post.email}}
<div class="gh-post-analytics-email-metrics gh-post-list-analytics-tt-container">
<div class="gh-post-list-analytics-tooltip {{this.tooltipPosition}}">
<h3>Newsletter performance</h3>
<div class="metrics">
{{!-- Always show sent count --}}
<div class="metric">
<div class="data">
{{svg-jar "analytics-sent"}}
Sent
</div>
<span>{{format-number @post.email.emailCount}}</span>
</div>
{{!-- Show opens when enabled --}}
{{#if @post.showEmailOpenAnalytics}}
<div class="metric">
<div class="data">
{{svg-jar "analytics-opens"}}
Opens
</div>
<span>{{format-number @post.email.openedCount}}</span>
</div>
{{/if}}
{{!-- Show clicks when enabled --}}
{{#if @post.showEmailClickAnalytics}}
<div class="metric">
<div class="data">
{{svg-jar "analytics-clicks"}}
Clicks
</div>
<span>{{format-number @post.count.clicks}}</span>
</div>
{{/if}}
</div>
</div>
{{!-- Opens column --}}
{{#if @post.showEmailOpenAnalytics}}
<a href="#/posts/analytics/{{@post.id}}/newsletter" class="permalink gh-list-data gh-post-list-metrics">
<div class="gh-post-list-analytics-metric" data-test-analytics-opens>
{{svg-jar "analytics-opens" class="gh-list-analytics-icon"}}
<span class="gh-content-email-stats-value">
{{@post.email.openRate}}%
</span>
</div>
</a>
{{/if}}
{{!-- Clicks column --}}
{{#if @post.showEmailClickAnalytics}}
<a href="#/posts/analytics/{{@post.id}}/newsletter" class="permalink gh-list-data gh-post-list-metrics">
<div class="gh-post-list-analytics-metric" data-test-analytics-clicks>
{{svg-jar "analytics-clicks" class="gh-list-analytics-icon"}}
<span class="gh-content-email-stats-value">
{{@post.clickRate}}%
</span>
</div>
</a>
{{/if}}
{{!-- Sent column (only when both clicks and opens are disabled) --}}
{{#if (and (not @post.showEmailClickAnalytics) (not @post.showEmailOpenAnalytics))}}
<a href="#/posts/analytics/{{@post.id}}/newsletter" class="permalink gh-list-data gh-post-list-metrics">
<div class="gh-post-list-analytics-metric" data-test-analytics-sent>
{{svg-jar "analytics-sent" class="gh-list-analytics-icon"}}
<span class="gh-content-email-stats-value">
{{abbreviate-number @post.email.emailCount}}
</span>
</div>
</a>
{{/if}}
</div>
{{/if}}
{{!-- Member conversions column (only show for published posts when traffic analytics is enabled AND web analytics is enabled) --}}
{{#if this.settings.membersTrackSources}}
{{#if @post.isPublished}}
<a href="#/posts/analytics/{{@post.id}}/growth" class="permalink gh-list-data gh-post-list-metrics gh-post-list-analytics-tt-container">
<div class="gh-post-list-analytics-tooltip {{this.tooltipPosition}}">
<h3>New members</h3>
<div class="metrics">
<div class="metric">
<div class="data">
{{svg-jar "analytics-free-members"}}
Free
</div>
<span>
{{#if this.hasMemberData}}
{{format-number this.memberCounts.free}}
{{else}}
0
{{/if}}
</span>
</div>
{{#if this.membersUtils.paidMembersEnabled}}
<div class="metric">
<div class="data">
{{svg-jar "analytics-paid-members"}}
Paid
</div>
<span>
{{#if this.hasMemberData}}
{{format-number this.memberCounts.paid}}
{{else}}
0
{{/if}}
</span>
</div>
{{/if}}
</div>
</div>
<div class="gh-post-list-analytics-metric" data-test-analytics-member-conversions>
{{svg-jar "analytics-members" class="gh-list-analytics-icon"}}
<span class="gh-content-email-stats-value">
{{#if this.hasMemberData}}
{{format-number this.totalMemberConversions}}
{{else}}
0
{{/if}}
</span>
</div>
</a>
{{/if}}
{{/if}}
</div>
{{!-- Button column --}}
{{#if @post.hasAnalyticsPage }}
<a href="#/posts/analytics/{{@post.id}}" class="permalink gh-list-data gh-post-list-button" title="">
<span class="gh-post-list-cta stats {{if this.isHovered "is-hovered"}}" title="Go to Analytics" data-ignore-select>
{{svg-jar "stats" title="Go to Analytics"}}
</span>
</a>
{{else}}
{{#if (and this.session.user.isContributor @post.isPublished)}}
<a href={{@post.url}} class="permalink gh-list-data gh-post-list-button" target="_blank" rel="noopener noreferrer">
<span class="gh-post-list-cta view {{if this.isHovered "is-hovered"}}" title="View post" data-ignore-select>
{{svg-jar "arrow-top-right" title="View post"}}
</span>
</a>
{{else}}
<LinkTo @route="lexical-editor.edit" @models={{array this.post.displayName this.post.id}} class="permalink gh-list-data gh-post-list-button" title="">
<span class="gh-post-list-cta edit {{if this.isHovered "is-hovered"}}" title="Go to Editor" data-ignore-select>
{{svg-jar "pen" title="Go to Editor"}}
</span>
</LinkTo>
{{/if}}
{{/if}}
</div>
</li>