Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize stats, clean up code, respect settings #2785

Merged
merged 4 commits into from
Mar 13, 2024

Conversation

yscik
Copy link
Contributor

@yscik yscik commented Mar 7, 2024

Fixes #2782 #2784

Stacked on #2776

Changes Proposed in this Pull Request

  • Remove unused stats settings, only leave "Enable job statistics". Move it to the General settings tab since it's only one setting for now. Update labels.
  • Make sure the setting is respected & stats are not logged or displayed when it's off
  • Rename stats to make DB keys a bit shorter (job_listing_view -> job_view)
  • Add constants, cleanup code
  • Various tweaks for the frontend framework:
    • Organize and rename a few things for better clarity
    • Make stats triggered by a custom event/action (only page-load now) a dedicated stat type with it's own setup (action)
  • And to observing search impressions:
    • Use a single IntersectionObserver to monitor the listing elements. Also use this for the initially visible listings, it'll trigger even when they are already in view
    • Clean up observer when a listing element is removed (this happens when search filters/keywords are changed)
    • Send the log request right away when 10 events are in the queue
    • Fix some timing issues causing nodes to be skipped sometimes
    • Move the job listing selectors to the PHP stat config, so theme authors can customize them

Testing Instructions

  • In Job Manager settings, turn on the Job Statistics option
  • Check that stats are logged correctly when viewing a job page ( job_listing, job_listing_unique, job_apply_click)
  • Check that stats are logged when viewing the job list. Test with both ajax search and static: [jobs] and [jobs show_filters=false]
  • Check that the above logging is only done when the settings is turned on
  • Check that the Views column in Job listings admin and the job dashboard, and the Job statistics overlay is only shown when the settings is turned on

Screenshot / Video

image
Plugin build for c418e1b
📦 Download plugin zip
▶️ Open in playground

@yscik yscik changed the base branch from feature/stats to add/job-overlay-stats March 7, 2024 16:01
@yscik yscik requested a review from a team March 7, 2024 16:03
This was linked to issues Mar 8, 2024
assets/js/stats/utils.js Show resolved Hide resolved
includes/class-job-listing-stats.php Outdated Show resolved Hide resolved
includes/class-job-listing-stats.php Outdated Show resolved Hide resolved
Copy link
Contributor

@thedebian thedebian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worked well, it needs a rebase though.
I had issues unrelated to this PR, reported on Slack.

Base automatically changed from add/job-overlay-stats to feature/stats March 13, 2024 13:47
@yscik yscik merged commit 5062080 into feature/stats Mar 13, 2024
11 checks passed
@yscik yscik deleted the change/optimize-stats branch March 13, 2024 13:55
This was referenced Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apply stats settings Optimize stat logging
2 participants