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

Refactor Tracks events props to util functions #5966

Merged
merged 21 commits into from
Nov 15, 2024

Conversation

mehmoodak
Copy link
Member

@mehmoodak mehmoodak commented Oct 31, 2024

Description

  • Refactor Tracks events props to util functions for easy use.
  • Add following properties in each track event
[
	'hosting_provider' => get_hosting_provider(),
	'is_vip_user'      => false,
	'is_multisite'     => is_multisite(),
	'wp_version'       => get_bloginfo( 'version' ),
]

Changelog Description

Updated

  • Refactored Tracks events props to utility functions and added additional global properties.

Pre-review checklist

Please make sure the items below have been covered before requesting a review:

  • This change works and has been tested locally or in Codespaces (or has an appropriate fallback).
  • This change works and has been tested on a sandbox.
  • This change has relevant unit tests (if applicable).
  • This change uses a rollout method to ease with deployment (if applicable - especially for large scale actions that require writes).
  • This change has relevant documentation additions / updates (if applicable).
  • I've created a changelog description that aligns with the provided examples.

Steps to Test

  1. Add following code
    function record_telemetry_event_in_footer() {
        $tracks = new \Automattic\VIP\Telemetry\Tracks();
        $tracks->record_event( 'local_event', [
            'hello' => 'vip',
        ] );
    }
    add_action('admin_footer', 'record_telemetry_event_in_footer');
2. Load the admin, wait for some time to see the event appear in Tracks and verify the event.

@mehmoodak mehmoodak self-assigned this Oct 31, 2024
Copy link

codecov bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 93.10345% with 4 lines in your changes missing coverage. Please review.

Project coverage is 30.51%. Comparing base (61cb023) to head (2d1cd2f).
Report is 31 commits behind head on develop.

Files with missing lines Patch % Lines
vip-support/class-vip-support-user.php 0.00% 4 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #5966      +/-   ##
=============================================
+ Coverage      30.40%   30.51%   +0.10%     
+ Complexity      4813     4808       -5     
=============================================
  Files            288      289       +1     
  Lines          21134    21153      +19     
=============================================
+ Hits            6426     6454      +28     
+ Misses         14708    14699       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mehmoodak mehmoodak changed the title Add Tracks props to use in frontend Pass Tracks analytics props to frontend Oct 31, 2024
@mehmoodak mehmoodak changed the title Pass Tracks analytics props to frontend Forward Tracks Analytics props to frontend Nov 2, 2024
@mehmoodak mehmoodak force-pushed the cafe-942/add-tracks-props-to-use-in-js branch from ffaba24 to 364800f Compare November 2, 2024 06:17
@mehmoodak mehmoodak force-pushed the cafe-942/add-tracks-props-to-use-in-js branch from 364800f to 5f15018 Compare November 2, 2024 06:40
@mehmoodak mehmoodak changed the title Forward Tracks Analytics props to frontend Refactor Tracks events props to utils functions Nov 5, 2024
@mehmoodak mehmoodak changed the title Refactor Tracks events props to utils functions Refactor Tracks events props to util functions Nov 5, 2024
@mehmoodak mehmoodak marked this pull request as ready for review November 5, 2024 18:18
@mehmoodak mehmoodak requested a review from a team as a code owner November 5, 2024 18:18
telemetry/tracks/class-tracks-event.php Show resolved Hide resolved
telemetry/tracks/tracks-utils.php Show resolved Hide resolved
@mehmoodak mehmoodak merged commit 05a72c5 into develop Nov 15, 2024
36 checks passed
@mehmoodak mehmoodak deleted the cafe-942/add-tracks-props-to-use-in-js branch November 15, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants