WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
woocommerce google analytics integration (2 posts)

  1. jadamsso
    Member
    Posted 1 year ago #

    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.

    http://wordpress.org/extend/plugins/woocommerce/

  2. joeyrudi
    Member
    Posted 12 months ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic