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

Add license type to what is reported to Mixpanel #6152

Closed
DahmaniAdame opened this issue Sep 8, 2023 · 3 comments · Fixed by #6189
Closed

Add license type to what is reported to Mixpanel #6152

DahmaniAdame opened this issue Sep 8, 2023 · 3 comments · Fixed by #6189
Assignees
Labels
effort: [XS] < 1 day of estimated development time priority: medium Issues which are important, but no one will go out of business. type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Milestone

Comments

@DahmaniAdame
Copy link
Contributor

This will help see how representative is the current sample from opted-in users vs our current users and how reliable data collected from them to help with product decisions.

@piotrbak piotrbak added type: enhancement Improvements that slightly enhance existing functionality and are fast to implement priority: medium Issues which are important, but no one will go out of business. needs: grooming labels Sep 10, 2023
@piotrbak
Copy link
Contributor

Acceptance Criteria:

  • WP Rocket's license type (Single, Plus, Infinite) should be reported to Mixpanel's Website Environment board

@jeawhanlee
Copy link
Contributor

Scope a solution ✅

We will get the customer data in

function rocket_analytics_data() {

$customer_data = get_transient( 'wp_rocket_customer_data' );

We need to get the license type in string format, we are already doing that here:

if (
1 <= $user->licence_account
&&
$user->licence_account < 3
) {
$data['license_type'] = 'Single';
} elseif ( -1 === (int) $user->licence_account ) {
$data['license_type'] = 'Infinite';
} else {
$data['license_type'] = 'Plus';
}

We can create a new function so we can share and reuse this block.

function get_license_type($customer_data) {
    $type = '';
    if ( false === $customer_data || ! isset( $customer_data->licence_account ) ) {
	    return $data;
    }

    if ( 1 <= $customer_data->licence_account && $customer_data->licence_account < 3
    ) {
	    $type = 'Single';
    } elseif ( -1 === (int) $customer_data->licence_account ) {
	    $type = 'Infinite';
    } else {
	    $type = 'Plus';
    }

    return $type;
}

and we can update the customer_data method with the new function for getting license type in strings

Finally we will update:

function rocket_analytics_data() {

$customer_data = get_transient( 'wp_rocket_customer_data' );
if ( false !== $customer_data ) {
  $data['license_type] = get_license_type($customer_data);
}

Estimate the effort ✅

[XS]

@CrochetFeve0251
Copy link
Contributor

That seems good to me

@piotrbak piotrbak added effort: [XS] < 1 day of estimated development time and removed needs: grooming labels Sep 21, 2023
@Miraeld Miraeld self-assigned this Sep 25, 2023
Miraeld pushed a commit that referenced this issue Sep 26, 2023
Adds the license type to data sent to Mixpanel.
Miraeld pushed a commit that referenced this issue Sep 26, 2023
Adds the license type to data sent to Mixpanel.
Miraeld pushed a commit that referenced this issue Sep 26, 2023
Adds the license type to data sent to Mixpanel.
Miraeld pushed a commit that referenced this issue Sep 26, 2023
Adds the license type to data sent to Mixpanel.
Miraeld pushed a commit that referenced this issue Sep 26, 2023
Adds the license type to data sent to Mixpanel.
Miraeld pushed a commit that referenced this issue Sep 27, 2023
Adds the license type to data sent to Mixpanel.
Miraeld pushed a commit that referenced this issue Oct 5, 2023
Adds the license type to data sent to Mixpanel.
github-merge-queue bot pushed a commit that referenced this issue Oct 6, 2023
Co-authored-by: Gael Robin <“robin.gael@gmail.com”>
Co-authored-by: Gael <gael@wp-media.me>
@piotrbak piotrbak added this to the 3.15.2 milestone Oct 9, 2023
@engahmeds3ed engahmeds3ed mentioned this issue Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: [XS] < 1 day of estimated development time priority: medium Issues which are important, but no one will go out of business. type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants