Update in-app product card clicked Tracks event (#51180)
* Add product and group id properties to Tracks data for product card clicks * Add changefile(s) from automation for the following project(s): woocommerce * Update product tracksproperty to product_id Co-authored-by: And Finally <andfinally@users.noreply.github.com> --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: And Finally <andfinally@users.noreply.github.com>
This commit is contained in:
parent
7dc26a8c66
commit
3b35e22c99
|
@ -31,6 +31,7 @@ function ProductCard( props: ProductCardProps ): JSX.Element {
|
||||||
const query = useQuery();
|
const query = useQuery();
|
||||||
// Get the product if provided; if not provided, render a skeleton loader
|
// Get the product if provided; if not provided, render a skeleton loader
|
||||||
const product = props.product ?? {
|
const product = props.product ?? {
|
||||||
|
id: null,
|
||||||
title: '',
|
title: '',
|
||||||
description: '',
|
description: '',
|
||||||
vendorName: '',
|
vendorName: '',
|
||||||
|
@ -81,6 +82,10 @@ function ProductCard( props: ProductCardProps ): JSX.Element {
|
||||||
data.group = tracksData.group;
|
data.group = tracksData.group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( tracksData.group_id ) {
|
||||||
|
data.group_id = tracksData.group_id;
|
||||||
|
}
|
||||||
|
|
||||||
if ( tracksData.searchTerm ) {
|
if ( tracksData.searchTerm ) {
|
||||||
data.search_term = tracksData.searchTerm;
|
data.search_term = tracksData.searchTerm;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +147,8 @@ function ProductCard( props: ProductCardProps ): JSX.Element {
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
onClick={ () => {
|
onClick={ () => {
|
||||||
recordTracksEvent( 'marketplace_product_card_clicked', {
|
recordTracksEvent( 'marketplace_product_card_clicked', {
|
||||||
product: product.title,
|
product_id: product.id,
|
||||||
|
product_name: product.title,
|
||||||
vendor: product.vendorName,
|
vendor: product.vendorName,
|
||||||
product_type: type,
|
product_type: type,
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -111,6 +111,9 @@ export default function ProductListContent( props: {
|
||||||
...( product.label && {
|
...( product.label && {
|
||||||
label: product.label,
|
label: product.label,
|
||||||
} ),
|
} ),
|
||||||
|
...( props.productGroup && {
|
||||||
|
group_id: props.productGroup,
|
||||||
|
} ),
|
||||||
...( props.group && { group: props.group } ),
|
...( props.group && { group: props.group } ),
|
||||||
...( props.searchTerm && {
|
...( props.searchTerm && {
|
||||||
searchTerm: props.searchTerm,
|
searchTerm: props.searchTerm,
|
||||||
|
|
|
@ -58,6 +58,7 @@ export interface ProductTracksData {
|
||||||
position?: number;
|
position?: number;
|
||||||
label?: string;
|
label?: string;
|
||||||
group?: string;
|
group?: string;
|
||||||
|
group_id?: string;
|
||||||
searchTerm?: string;
|
searchTerm?: string;
|
||||||
category?: string;
|
category?: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: tweak
|
||||||
|
|
||||||
|
Include group and product id properties in the `marketplace_product_card_clicked` Tracks event
|
Loading…
Reference in New Issue