-
Notifications
You must be signed in to change notification settings - Fork 68
General Testing
Miguel Pérez Pellicer edited this page Mar 12, 2024
·
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.
- Recommended (you can also check the requests manually tho) to use a debugger tool like Google Analytics Debugger Extension or Tag Assistant (official)
0. Installation 🧪
- 🧪 Activating the plugin doesn't cause errors.
- 🧪 Deactivating the plugin doesn't cause errors.
1. Settings
- 🧪 Go to
Settings( WooCommerce → Settings → Integration → Google Analytics ) - 🧪 Confirm it loads OK.
- Confirm that "Product Identification" appears and you can select between Product ID and SKU
- Confirm that "Google Analytics Tracking ID" field appears. Add a test tracking like:
G-28QSQJCS9D - Select all: "Display Advertising" Support, Purchase Transactions, Add to Cart Events, Remove from Cart Events, Product Impressions from Listing Pages, Product Clicks from Listing Pages, Product Detail Views, Checkout Process Initiated
2. Check scrips and data is loaded 🧪
- 🧪 As guest or not admin. check
google-tag-manager-jsscript is loading async https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX - 🧪 As guest or not admin. check
woocommerce-google-analytics-integration-js-beforescript is loaded with all the WCGAI config - 🧪 As guest or not admin. check
woocommerce-google-analytics-integration-jsscript is loaded the main file - 🧪 As guest or not admin. check
woocommerce-google-analytics-integration-js-afterscript is loaded with all the trackingClassic config - 🧪 As guest or not admin. Go to shop and verify
page_viewis sent - 🧪 Log as admin. None of those scripts should be attached.
3. Check consent
- Check that the default consent is enabled
gtag("consent", "default", {
analytics_storage: "denied",
ad_storage: "denied",
ad_user_data: "denied",
ad_personalization: "denied",
region: [
"AT",
"BE",
"BG",
"HR",
"CY",
"CZ",
"DK",
"EE",
"FI",
"FR",
"DE",
"GR",
"HU",
"IS",
"IE",
"IT",
"LV",
"LI",
"LT",
"LU",
"MT",
"NL",
"NO",
"PL",
"PT",
"RO",
"SK",
"SI",
"ES",
"SE",
"GB",
"CH"
]
})
- Add a snippet for changing those settings, and verify is being sent in the debugger:
add_filter( 'woocommerce_ga_gtag_consent_modes', function ( $consent_modes ) {
$consent_modes[] =
array(
'analytics_storage' => 'granted',
'ad_storage' => 'granted',
'ad_user_data' => 'granted',
'ad_personalization' => 'granted',
'region' => ['ES'],
);
return $consent_modes;
} );
4. Check default theme shop page events
- 🧪 Go to that page and verify that
view_item_listis being triggered for the products in the grid. - 🧪 Click on Add to Cart in one of the products and verify
add_to_cartis being triggered. - Click on the product image in one of the products and verify that
select_contentis being triggered.
5. Check blocks (Products Beta) events
Prereqs. Create a page with "Poducts Beta" block on it.
- 🧪 Go to that page and verify that
view_item_listis being triggered for the products in the grid. - 🧪 Click on Add to Cart in one of the products and verify
add_to_cartis being triggered. - Click on the product image in one of the products and verify that
select_contentis being triggered.
6. Check blocks (All Products) events
Prereqs. Create a page with "All Products" block on it.
- 🧪 Go to that page and verify that
view_item_listis being triggered for the products in the grid. - 🧪 Click on Add to Cart in one of the products and verify
add_to_cartis being triggered. - Click on the product image in one of the products and verify that
select_contentis being triggered.
7. Check triggers (Classic pages) events
Prereqs. Create a page with [products] shortcode on it.
- 🧪 Go to that page and verify that
view_item_listis being triggered for the products in the grid. - 🧪 Click on Add to Cart in one of the products and verify
add_to_cartis being triggered. - Click on the product image in one of the products and verify that
select_contentis being triggered.
8. Check Single product page events
- 🧪 In the single product page check that
view_itemis triggered. - 🧪 In the single product page check that
view_item_listis triggered for the related items. - 🧪 Add one of those related items to the cart. Verify
add_to_cartis being triggered. - Click on the name of one of those related items. Verify that
select_contentis being triggered. - 🧪 In the single product page. Add the item to cart. Verify
add_to_cartis being triggered. - 🧪 In a variable page. Add the item to cart. Verify
add_to_cartis being triggered.
8. Check Cart
- 🧪 Open the cart on the side and remove an item. Verify that
remove_from_cartevent was triggered. - 🧪 Go to the cart page and remove an item. Verify that
remove_from_cartevent was triggered.
8. Check Purchase
- 🧪 Add an item to the cart. And go to Checkout. Verify that
begin_checkoutwas triggered. - 🧪 Place the order. Verify that
purchasewas triggered.
9. Disabling events
- Go to Settings and uncheck everything in "Event Tracking" section.
- Verify that
view_item_listevent is not being triggered anymore. - Verify that
add_to_cartevent is not being triggered anymore. - Verify that
select_contentevent is not being triggered anymore. - Verify that
view_itemevent is not being triggered anymore. - Verify that
remove_from_cartevent is not being triggered anymore. - Verify that
begin_checkoutis not triggered. - Verify that
purchaseis not triggered.