Update classes/integrations/google-analytics/class-wc-google-analytics.php
Added SKU tracking for shop loop
This commit is contained in:
parent
2086c66d22
commit
a0dfdad79b
|
@ -275,7 +275,7 @@ class WC_Google_Analytics extends WC_Integration {
|
|||
// Add single quotes to allow jQuery to be substituted into _trackEvent parameters
|
||||
$parameters['category'] = "'" . __( 'Products', 'woocommerce' ) . "'";
|
||||
$parameters['action'] = "'" . __( 'Add to Cart', 'woocommerce' ) . "'";
|
||||
$parameters['label'] = "'#' + $(this).attr('data-product_id')"; // Product ID
|
||||
$parameters['label'] = "($(this).hasAttr('data-product_sku')) ? ('SKU: ' + $(this).attr('data-product_sku')) : ('#' + $(this).attr('data-product_id))"; // Product SKU or ID
|
||||
|
||||
$this->event_tracking_code( $parameters, '.add_to_cart_button:not(.product_type_variable, .product_type_grouped)' );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue