Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Integrate with Google Analytics #3175

Closed
nerrad opened this issue Sep 21, 2020 · 4 comments · Fixed by #4020
Closed

Integrate with Google Analytics #3175

nerrad opened this issue Sep 21, 2020 · 4 comments · Fixed by #4020
Assignees
Labels
block: cart Issues related to the cart block. block: checkout Issues related to the checkout block. category: extensibility Work involving adding or updating extensibility. Useful to combine with other scopes impacted. type: epic A label used by Zenhub for indicating issues functioning as an Epic.

Comments

@nerrad
Copy link
Contributor

nerrad commented Sep 21, 2020

Currently Google Analytics (WooCommerce core option) integrates with the Cart and Checkout flow to trigger events for GA. We need to ensure that purchases through the cart and checkout block flow triggers the appropriate events (and any related extensibility points are available for those trigger points).

As much as possible split up the work into independent chunks, for now use this as a tracking issue.

@nerrad nerrad added category: extensibility Work involving adding or updating extensibility. Useful to combine with other scopes impacted. block: cart Issues related to the cart block. block: checkout Issues related to the checkout block. labels Sep 21, 2020
@nerrad nerrad added the type: epic A label used by Zenhub for indicating issues functioning as an Epic. label Nov 18, 2020
@zdenys
Copy link

zdenys commented Dec 30, 2020

User request about this lacking feature: https://wordpress.org/support/topic/google-analytics-conversion-tracking-4/

@nerrad nerrad assigned budzanowski and unassigned budzanowski Feb 28, 2021
@mikejolley mikejolley self-assigned this Mar 5, 2021
@mikejolley
Copy link
Member

Current Events:

  • listing_impression (ec:addImpression) - woocommerce_after_shop_loop_item
  • listing_click (ec:setAction click) - woocommerce_after_shop_loop_item
  • add_transaction (ec:setAction purchase) - is_order_received_page()
  • remove_from_cart (ec:setAction remove) - woocommerce_after_cart
  • product_detail (ec:setAction detail) - woocommerce_after_single_product
  • checkout_process (ec:setAction checkout) - woocommerce_after_checkout_form
  • add to cart (ec:setAction add) - woocommerce_after_add_to_cart_button

https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/trunk/includes/class-wc-google-analytics-js.php

As a minimum we need to emit on:

  • Add to Cart
  • Remove from cart/update cart item
  • When rendering a product
  • Clicking an product link
  • On Checkout

Blocks still uses the order received page so add_transaction is covered. If we use a block in the future we'll need a new event.

@mikejolley
Copy link
Member

Data requirements:

Add to Cart / Listing Impression / Listing Click
id
sku
title
quantity
product_cat term names of current product and parent product
is current query a search?

Checkout
As above for all items in cart plus,
variation data (wc_get_formatted_variation)
price

Transaction
Order Number
Order Total
Total Tax
Total Shipping
Items (product data same as above)
Items: "get_item_total"
Billing city, state, country

@mikejolley
Copy link
Member

Analytics Pro Events That Intersect with Blocks:

(https://github.com/woocommerce/woocommerce-google-analytics-pro/blob/master/includes/class-sv-wc-tracking-integration.php)

Note some of these use server side hooks which the API still uses, so won't all need a JS event.

  • viewed_product (woocommerce_after_single_product_summary)
  • clicked_product (woocommerce_before_shop_loop_item)
  • added_to_cart
  • removed_from_cart
  • changed_cart_quantity
  • viewed_cart
  • started_checkout
  • provided_billing_email
  • selected_payment_method
  • placed_order
  • started_payment
  • completed_purchase
  • applied_coupon
  • removed_coupon
  • estimated_shipping
  • product_impression

Product impression data:

  • id
  • title
  • "list type" uses the current query. We could use block name here.
  • brand (brands extension)
  • category
  • variant
  • position in loop
  • price

Cart event data:

  • cart_item_key
  • product
  • quantity

Checkout event data:

  • Is user logged in?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: cart Issues related to the cart block. block: checkout Issues related to the checkout block. category: extensibility Work involving adding or updating extensibility. Useful to combine with other scopes impacted. type: epic A label used by Zenhub for indicating issues functioning as an Epic.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants