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 ) => (
<ProductList
key={ groups.id }
productGroup={ groups.id }
title={ groups.title }
products={ groups.items }
groupURL={ groups.url }

View File

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

View File

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

View File

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

View File

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