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 usage tracking for Setup Wizard Course Theme step #6252

Conversation

alexsanford
Copy link
Contributor

Fixes #6227

Changes proposed in this Pull Request

  • Log an event when user chooses to install the Course Theme from the Setup Wizard.

Testing instructions

  • Set up your testing environment to log usage tracking events. You can use event-monitor for this, or simply log to the error_log. Here is an example code snippet which does both.
add_filter( 'pre_http_request', function( $preempt, $r, $url ) {
  	$event_monitor_url = 'http://localhost:8888/pixel/';
  	$host              = parse_url( $url, PHP_URL_HOST );
  	$path              = parse_url( $url, PHP_URL_PATH );
  	if ( 'pixel.wp.com' === $host && '/t.gif' === $path ) {
  		error_log( 'Logging Tracks event:' );
  		error_log( $url );
  		
  		$http    = _wp_http_get_object();
  		$new_url = $event_monitor_url . '?' . parse_url( $url, PHP_URL_QUERY );

  		error_log( $new_url );

  		return $http->request( $new_url, $r );
  	}
  	return $preempt;
  }, 10, 3 );
  • Walk through the Setup Wizard. Choose to install the theme. Ensure thesensei_setup_wizard_install_theme event is logged.
  • Walk through the Setup Wizard again. Choose NOT to install the theme. Ensure the sensei_setup_wizard_install_theme event is not logged.

@alexsanford alexsanford requested a review from a team December 7, 2022 21:08
@alexsanford alexsanford self-assigned this Dec 7, 2022
@codecov
Copy link

codecov bot commented Dec 7, 2022

Codecov Report

Merging #6252 (85a5183) into feature/onboarding-theme-step (929889c) will decrease coverage by 0.00%.
The diff coverage is 59.67%.

Impacted file tree graph

@@                         Coverage Diff                         @@
##             feature/onboarding-theme-step    #6252      +/-   ##
===================================================================
- Coverage                            45.76%   45.76%   -0.01%     
- Complexity                            9483     9491       +8     
===================================================================
  Files                                  457      457              
  Lines                                33586    33621      +35     
  Branches                               274      274              
===================================================================
+ Hits                                 15370    15385      +15     
- Misses                               18011    18031      +20     
  Partials                               205      205              
Impacted Files Coverage Δ
assets/admin/students/student-modal/course-list.js 76.00% <ø> (ø)
assets/setup-wizard/data/reducer.js 84.61% <ø> (ø)
includes/admin/class-sensei-setup-wizard.php 34.28% <ø> (ø)
.../admin/tools/class-sensei-tool-enrolment-debug.php 0.00% <0.00%> (ø)
includes/class-sensei-grading-main.php 0.00% <ø> (ø)
includes/class-sensei-grading.php 11.66% <0.00%> (ø)
includes/class-sensei-learner.php 46.54% <0.00%> (-1.58%) ⬇️
includes/class-sensei-lesson.php 37.11% <0.00%> (ø)
includes/class-sensei-modules.php 38.23% <0.00%> (ø)
includes/class-sensei-notices.php 60.00% <ø> (ø)
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d2bdb33...85a5183. Read the comment docs.

@alexsanford alexsanford linked an issue Dec 8, 2022 that may be closed by this pull request
Copy link
Member

@jom jom left a comment

Choose a reason for hiding this comment

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

Looks good and works well! I was wondering if it was worth firing the event when we didn't install the theme (with a null property or something), but I think this should be enough.

@alexsanford alexsanford merged commit 305c414 into feature/onboarding-theme-step Dec 8, 2022
@alexsanford alexsanford deleted the add/setup-wizard-course-theme-usage-tracking branch December 8, 2022 19:34
@donnapep donnapep added this to the 4.10.0 milestone May 1, 2023
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.

Maybe implement theme step tracking
3 participants