MCPcopy Create free account
hub / github.com/dailydotdev/apps / feedHighlightsLogEvent

Function feedHighlightsLogEvent

packages/shared/src/lib/feed.ts:195–235  ·  view source on GitHub ↗
(
  eventName: string,
  {
    action,
    columns,
    column,
    row,
    feedName,
    ranking,
    count,
    clickedHighlight,
    highlightIds,
    feedMeta,
    position,
    origin,
  }: FeedHighlightsLogEventOptions,
)

Source from the content-addressed store, hash-verified

193}
194
195export function feedHighlightsLogEvent(
196 eventName: string,
197 {
198 action,
199 columns,
200 column,
201 row,
202 feedName,
203 ranking,
204 count,
205 clickedHighlight,
206 highlightIds,
207 feedMeta,
208 position,
209 origin,
210 }: FeedHighlightsLogEventOptions,
211): FeedItemLogEvent {
212 return {
213 event_name: eventName,
214 feed_grid_columns: columns,
215 feed_item_grid_column: column,
216 feed_item_grid_row: row,
217 feed_item_meta: feedMeta ?? undefined,
218 feed_item_target_url: clickedHighlight?.post.commentsPermalink,
219 feed_item_title: clickedHighlight?.headline,
220 target_type: TargetType.HighlightsCard,
221 extra: JSON.stringify({
222 ...feedLogExtra(feedName, ranking, undefined, origin).extra,
223 ...(action ? { action } : {}),
224 ...(typeof count === 'number' ? { count } : {}),
225 ...(typeof position === 'number' ? { position } : {}),
226 ...(highlightIds?.length ? { highlight_ids: highlightIds } : {}),
227 ...(clickedHighlight
228 ? {
229 clicked_highlight_id: clickedHighlight.id,
230 post_id: clickedHighlight.post.id,
231 }
232 : {}),
233 }),
234 };
235}
236
237export interface GetDefaultFeedProps {
238 hasFiltered?: boolean;

Callers 5

FeedItemComponentFunction · 0.90
onHighlightClickFunction · 0.90
onReadAllClickFunction · 0.90
useLogImpressionFunction · 0.90

Calls 1

feedLogExtraFunction · 0.85

Tested by

no test coverage detected