Update classes/integrations/google-analytics/class-wc-google-analytics.php

Added SKU tracking for shop loop
This commit is contained in:
yitzchak 2013-02-13 14:31:21 -05:00
parent 2086c66d22
commit a0dfdad79b
1 changed files with 1 additions and 1 deletions

View File

@ -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)' );
}