Automattic/WP-Job-Manager

Optimize stat logging

Closed this issue · 1 comments

A few follow-up optimizations and improvements to look at

All stats:

Search impressions stats (#2771):

  • Batch writing the events to DB
  • Maybe reduce request payload size? Could compress into one event with multiple post IDs? Eg { job_listing_impression: [ 11, 12, 13, 14 ] }
  • Debounce: send if 10 or so events are in the queue, don't wait for scrolling to stop
  • Check if the JS is blocking rendering and if anything could be moved off the main thread
  • Fix: investigate why sometimes a few listings are missed — registered as viewed but not as sent
  • Maybe move CSS selectors in the observers to PHP so it's filterable if a theme is using different classes?
  • Optimize page_has_jobs_shortcode check

Closed by #2785.