In-App Marketplace: Record the legacy Tracks event for Discover page (#51163)

* In-App Marketplace: Record the legacy Tracks event for Discover page

Fixes #21486

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Cem Ünalan 2024-09-13 00:13:13 +03:00 committed by GitHub
parent 0e930533e9
commit 3300aef6c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import ProductLoader from '../product-loader/product-loader';
import { MarketplaceContext } from '../../contexts/marketplace-context'; import { MarketplaceContext } from '../../contexts/marketplace-context';
import { ProductType } from '../product-list/types'; import { ProductType } from '../product-list/types';
import './discover.scss'; import './discover.scss';
import { recordMarketplaceView } from '~/marketplace/utils/tracking';
export default function Discover(): JSX.Element | null { export default function Discover(): JSX.Element | null {
const [ productGroups, setProductGroups ] = useState< const [ productGroups, setProductGroups ] = useState<
@ -28,10 +29,17 @@ export default function Discover(): JSX.Element | null {
return product.id; return product.id;
} ); } );
// This is a new event specific to the Discover tab, added with Woo 8.4.
recordEvent( 'marketplace_discover_viewed', { recordEvent( 'marketplace_discover_viewed', {
view: 'discover', view: 'discover',
product_ids, product_ids,
} ); } );
// This is the new page view event added with Woo 8.3. It's improved with the marketplace_discover_viewed event
// but we'll keep it for a while to keep it compatible.
recordMarketplaceView( {
view: 'discover',
} );
} }
// Get the content for this screen // Get the content for this screen

View File

@ -0,0 +1,4 @@
Significance: patch
Type: tweak
Comment: Fix missing Tracks event from the Extensions > Discover page