Skip to content

Commit

Permalink
Update element_statistics for schema feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jethron committed Jan 7, 2025
1 parent b8cc5df commit ef814ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions plugins/browser-plugin-element-tracking/src/elementsState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ export function aggregateStats(
min_size: minSize.join('x'),
current_size: curSize.join('x'),
max_size: maxSize.join('x'),
y_depth_percentage: curDepth[1] === 0 ? null : curDepth[0] / curDepth[1],
max_y_depth_percentage: maxDepth[1] === 0 ? null : maxDepth[0] / maxDepth[1],
y_depth_ratio: curDepth[1] === 0 ? null : curDepth[0] / curDepth[1],
max_y_depth_ratio: maxDepth[1] === 0 ? null : maxDepth[0] / maxDepth[1],
max_y_depth: maxDepth.join('/'),
element_age_ms: performance.now() - (state.createdTs - performance.timeOrigin),
element_age_ms: Math.floor(performance.now() - (state.createdTs - performance.timeOrigin)),
times_in_view: state.views,
total_time_visible_ms: state.elapsedVisibleMs,
total_time_visible_ms: Math.floor(state.elapsedVisibleMs),
},
};
}
4 changes: 2 additions & 2 deletions plugins/browser-plugin-element-tracking/src/schemata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ export type ElementStatisticsEntity = SDJ<
min_size: string;
current_size: string;
max_size: string;
y_depth_percentage: number | null;
max_y_depth_percentage: number | null;
y_depth_ratio: number | null;
max_y_depth_ratio: number | null;
max_y_depth: string;
element_age_ms: number;
times_in_view: number;
Expand Down

0 comments on commit ef814ed

Please sign in to comment.