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();
|
||||
// Get the product if provided; if not provided, render a skeleton loader
|
||||
const product = props.product ?? {
|
||||
id: null,
|
||||
title: '',
|
||||
description: '',
|
||||
vendorName: '',
|
||||
|
@ -81,6 +82,10 @@ function ProductCard( props: ProductCardProps ): JSX.Element {
|
|||
data.group = tracksData.group;
|
||||
}
|
||||
|
||||
if ( tracksData.group_id ) {
|
||||
data.group_id = tracksData.group_id;
|
||||
}
|
||||
|
||||
if ( tracksData.searchTerm ) {
|
||||
data.search_term = tracksData.searchTerm;
|
||||
}
|
||||
|
@ -142,7 +147,8 @@ function ProductCard( props: ProductCardProps ): JSX.Element {
|
|||
rel="noopener noreferrer"
|
||||
onClick={ () => {
|
||||
recordTracksEvent( 'marketplace_product_card_clicked', {
|
||||
product: product.title,
|
||||
product_id: product.id,
|
||||
product_name: product.title,
|
||||
vendor: product.vendorName,
|
||||
product_type: type,
|
||||
} );
|
||||
|
|
|
@ -111,6 +111,9 @@ export default function ProductListContent( props: {
|
|||
...( product.label && {
|
||||
label: product.label,
|
||||
} ),
|
||||
...( props.productGroup && {
|
||||
group_id: props.productGroup,
|
||||
} ),
|
||||
...( props.group && { group: props.group } ),
|
||||
...( props.searchTerm && {
|
||||
searchTerm: props.searchTerm,
|
||||
|
|
|
@ -58,6 +58,7 @@ export interface ProductTracksData {
|
|||
position?: number;
|
||||
label?: string;
|
||||
group?: string;
|
||||
group_id?: string;
|
||||
searchTerm?: 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