• jadamsso

    (@jadamsso)


    I have selected the option to generate a Google Analytics event when the Add to Card is selected. Except that the event label passed to the function is the product ID. The code is found in class-wc-google-analytics.php, and in particular in this line:

    $parameters[‘label’] = “‘#’ + $(this).attr(‘data-product_id’)”; // Product ID

    I have two questions. First, is there a variable that I can use so that my product SKU is used instead of the product ID? Second, how can I override this function without directly editing the original file?

    Any help would be appreciated.

    https://www.ads-software.com/extend/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • jadamsso,

    I’m guessing you’ve already solved this issue, but just in case…

    At least as of WooCommerce 2.0.12, the SKU gets recorded in GA if it is set on your product. In GA, when you look at Content -> Events -> Top Events, you have to select “Event Label” in the Primary Dimension in order to see the SKU.

    Also, for other general troubleshooting tips for WooCommerce and Google Analytics integration, you can check this article.

    But I hope this point is moot for you.

Viewing 1 replies (of 1 total)
  • The topic ‘woocommerce google analytics integration’ is closed to new replies.