Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 31 additions & 9 deletions includes/Tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,7 @@ public function register(): void {
false
);

if ( ! $this->context->is_story_editor() && 'web-story' !== $this->context->get_screen_post_type() ) {
return;
}

wp_add_inline_script(
self::SCRIPT_HANDLE,
'window.webStoriesTrackingSettings = ' . wp_json_encode( $this->get_settings() ) . ';'
);
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
}

/**
Expand All @@ -169,7 +162,36 @@ public function register(): void {
* @return string Registration action to use.
*/
public static function get_registration_action(): string {
return 'admin_head';
return 'init';
}

/**
* Get the action priority to use for registering the service.
*
* @since 1.43.0
*
* @return int Registration action priority to use.
*/
public static function get_registration_action_priority(): int {
return 1;
}

/**
* Enqueues tracking scripts
*
* @since 1.43.0
*
* @param string $hook_suffix The current admin page.
*/
public function enqueue_assets( string $hook_suffix ): void {
if ( ! $this->context->is_story_editor() && 'web-story' !== $this->context->get_screen_post_type() ) {
return;
}

wp_add_inline_script(
self::SCRIPT_HANDLE,
'window.webStoriesTrackingSettings = ' . wp_json_encode( $this->get_settings() ) . ';'
);
}

/**
Expand Down
2 changes: 0 additions & 2 deletions tests/phpunit/unit/tests/Shopping/WooCommerce_Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ public function set_up(): void {
* @covers ::get_search
*/
public function test_products_image(): void {
$this->markTestSkipped( 'Currently failing, needs investigation' );

Monkey\Functions\stubs(
[
'wc_get_products' => static function () {
Expand Down
Loading