Add UTM group to product URL on the Discover page (#41967)

* Add utm_category to discover page

* Fix product category URL params

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

* Update productCategory to productGroup in Discover and NoResults components

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

---------

Co-authored-by: Simran <simran.kaur@automattic.com>
Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Simran Vijwani 2023-12-21 02:13:52 +04:00 committed by GitHub
parent d8e01b23cd
commit 8e351f2f15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 4 deletions

View File

@ -73,6 +73,7 @@ export default function Discover(): JSX.Element | null {
{ groupsList.map( ( groups ) => ( { groupsList.map( ( groups ) => (
<ProductList <ProductList
key={ groups.id } key={ groups.id }
productGroup={ groups.id }
title={ groups.title } title={ groups.title }
products={ groups.items } products={ groups.items }
groupURL={ groups.url } groupURL={ groups.url }

View File

@ -101,6 +101,7 @@ export default function NoResults( props: {
title={ productListTitle( productGroup.id ) } title={ productListTitle( productGroup.id ) }
products={ productGroup.items } products={ productGroup.items }
groupURL={ productGroup.url } groupURL={ productGroup.url }
productGroup={ productGroup.id }
type={ productGroup.itemType } type={ productGroup.itemType }
key={ productGroup.id } key={ productGroup.id }
/> />

View File

@ -15,6 +15,7 @@ import { getAdminSetting } from '../../../utils/admin-settings';
export default function ProductListContent( props: { export default function ProductListContent( props: {
products: Product[]; products: Product[];
group?: string; group?: string;
productGroup?: string;
type: ProductType; type: ProductType;
className?: string; className?: string;
searchTerm?: string; searchTerm?: string;
@ -50,9 +51,12 @@ export default function ProductListContent( props: {
price: product.price, price: product.price,
url: appendURLParams( url: appendURLParams(
product.url, product.url,
Object.entries( Object.entries( {
wccomHelperSettings.inAppPurchaseURLParams ...wccomHelperSettings.inAppPurchaseURLParams,
) ...( props.productGroup !== undefined
? { utm_group: props.productGroup }
: {} ),
} )
), ),
description: product.description, description: product.description,
} } } }

View File

@ -7,13 +7,14 @@ import { Product, ProductType } from './types';
interface ProductListProps { interface ProductListProps {
title: string; title: string;
productGroup?: string;
products: Product[]; products: Product[];
groupURL: string; groupURL: string;
type: ProductType; type: ProductType;
} }
export default function ProductList( props: ProductListProps ): JSX.Element { export default function ProductList( props: ProductListProps ): JSX.Element {
const { title, products, groupURL, type } = props; const { title, products, groupURL, type, productGroup } = props;
return ( return (
<div className="woocommerce-marketplace__product-list"> <div className="woocommerce-marketplace__product-list">
@ -22,6 +23,7 @@ export default function ProductList( props: ProductListProps ): JSX.Element {
group={ title } group={ title }
products={ products } products={ products }
type={ type } type={ type }
productGroup={ productGroup }
/> />
</div> </div>
); );

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Add UTM group to product URL on the Discover page