-
Notifications
You must be signed in to change notification settings - Fork 68
General Testing
martynmjones edited this page Mar 6, 2023
·
39 revisions
Prereqs: Configured WooCommerce with products, and a valid payment processor (dev Stripe, or cash on delivery option in WC Settings > Payments) so that you can complete checkout.
Be sure to check the browser console as well as the WP debug log for errors. Make sure there is no ad blockers in your browser.
- Installation
- Activating the plugin doesn't cause errors.
- Deactivating the plugin doesn't cause errors.
- Settings
-
Settingslink from the WCGA row on the Plugin page or WooCommerce → Settings → Integration → Google Analytics - Confirm it loads OK.
- Checking "Use Global Site Tag" hides "Set Domain Name" and "Enable Universal Analytics"
- One or both of "Use Global Site Tag" or "Enable Universal Analytics" shows "Enhanced eCommerce"
- "Enable Enhanced eCommerce" toggles the EEC options.
-
- Global Site tag
- Add a tracking code (valid Global Site Tag format, like
G-28QSQJCS9D), Select "Use Global Site Tag" and all Tracking Options EXCEPT "Accept Incoming Linker Parameters". - Enable "Enable Enhanced eCommerce" and all sub-options.
- Visit non-store page (NOT AS ADMIN).
- Confirm general gtag scripts:
<script async src="https://www.googletagmanager.com/gtag/js?id=G-28QSQJCS9D">andgtag('set', 'developer_id.dOGY3NW', true);andgtag('config', 'G-28QSQJCS9D', { 'allow_google_signals': true, 'link_attribution': true, 'anonymize_ip': true, 'custom_map': { 'dimension1': 'logged_in' }, 'linker':{ 'domains': [], 'allow_incoming': false, }, 'logged_in': 'no' } );
- Confirm general gtag scripts:
- Visit shop page (with open Network panel and enable "Preserve log")
- Confirm above general gtag scripts
- Confirm multiple
gtag( 'event', 'view_item_list',and multiplegtag( 'event', 'select_content',for each product - Confirm multiple
gtag( 'event', 'add_to_cart', - In network panel:
- Confirm request to
www.googletagmanager.com/gtag/js?id=G-28QSQJCS9D… - Confirm one POST request to
google-analytics.com/g/collect, withen=page_viewand multipleen=view_item_listin the request payload (Payload tab of network request):
- After clicking on an "Add to cart" button on the shop, confirm the request to
google-analytics.com/g/collectwithen=add_to_cart - - NOTE: Not currently working, see #208 -
After clicking on an individual product (not a variable product), confirm the request to
google-analytics.com/g/collectwithen=select_content
- Confirm request to
- Click through to individual product page (not a variable product)
- Confirm general gtags
- Confirm
$( '.single_add_to_cart_button' ).on('click', function() {andgtag('event', 'add_to_cart', {"items": [item_data]}) - Confirm
gtag( 'event', 'view_item_list',andgtag( 'event', 'select_content',for all related products - In network panel:
- Confirm request to
www.googletagmanager.com/gtag/js?id=G-28QSQJCS9D… - Confirm either:
- Multiple requests to
google-analytics.com/g/collectwithen=view_item_list - And one request to
google-analytics.com/g/collectwithen=view_item-OR- - One POST request to
google-analytics.com/g/collectwith a payload of oneen=view_itemand multipleen=view_item_list
- Multiple requests to
- After clicking on an "Add to cart" button on the product, confirm the request to
google-analytics.com/g/collectwithen=add_to_cart(either in the URL or in the "payload")
- Confirm request to
- Go to the cart
- Confirm general gtags
- Confirm
gtag( 'event', 'remove_from_cart', { - In network panel:
- After removing an item from the cart, confirm the request to
google-analytics.com/g/collectwithen=remove_from_cartNOTENot working as of 2022-04-27Confirmed working as of 2022-08-29.
- After removing an item from the cart, confirm the request to
- Proceed to checkout
- Place the order
- Confirm general gtags
- Confirm
gtag( 'event', 'purchase', {with corresponding details - In network panel:
- Confirm the request to
google-analytics.com/g/collectwithen=purchase
- Confirm the request to
- Add a tracking code (valid Global Site Tag format, like
- Universal Analytics
- Return to the WCGA settings page and disable "Use Global Site Tag"
- Make sure "Enable Universal Analytics" is selected.
- Disabled "Enable Enhanced eCommerce".
- Leave the same GA ID (eg,
G-28QSQJCS9D) - Visit shop page:
- Confirm the code
ga( 'create', 'G-28QSQJCS9D', 'auto' )is inserted into the page, as well asga('send', 'event', 'Products', 'Add to Cart'andga( 'send', 'pageview' );
- Confirm the code
- Add an item to the cart
- Confirm the request to
http://www.google-analytics.com/collectcontainingea=Add%20to%20Cart
- Confirm the request to
- Click on a product
- Confirm the code
ga( 'create', 'G-28QSQJCS9D', 'auto' )is inserted into the page - Confirm
ga('send', 'event', 'Products',…for.single_add_to_cart_buttonand foradd_to_cart_button:not(… - Confirm
ga( 'send', 'pageview' );
- Confirm the code
- On cart and checkout
- Confirm the code
ga( 'create', 'G-28QSQJCS9D', 'auto' )is inserted into the page, as well asga('send', 'event', 'Products',…andga( 'send', 'pageview' );
- Confirm the code
- After completing checkout,
- Confirm the code
ga('ecommerce:addTransaction',…,ga('ecommerce:addItem',…(for each item in the cart), andga('ecommerce:send')is inserted into the page - Confirm the requests to
http://www.google-analytics.com/collect, one witht=transaction, on or more witht=item(according to number of items in the cart), and one witht=pageview
- Confirm the code
Another smoke testing section using the WooCommerce Block checkout wouldn't be a bad addition here.
- Remove cart item
- View item and select item events from product blocks