Events are not being tracked on the checkout page (Analytics, Facebook)
-
Hi again,
We are using Klarna Checkout as our primary checkout solution. Further we use “Facebook for WooCommerce” (https://woocommerce.com/products/facebook/) and “WooCommerce Google Analytics Pro” (https://woocommerce.com/products/woocommerce-google-analytics-pro/).
Both plugins work fine! However only on the the Klarna checkout page we are missing events being fired from both plugins. For example, “Facebook for WooCommerce” usually fires this javascript code on the regular WooCommerce checkout page:<script type="text/javascript"> jQuery(function($) { /* WooCommerce Facebook Integration Event Tracking */ fbq('track', 'InitiateCheckout', { "source": "woocommerce", "version": "4.3.1", "pluginVersion": "2.0.0", "num_items": 3, "content_ids": "[\"101_20611\",\"wc_post_id_61627\",\"wc_post_id_67677\"]", "content_name": "[\"Product Name 1\",\"Product Name 2",\"Product Name 3"]", "content_type": "product", "contents": "[{\"id\":\"101_20611\",\"quantity\":1},{\"id\":\"wc_post_id_61627\",\"quantity\":1},{\"id\":\"wc_post_id_67677\",\"quantity\":1}]", "value": "149.00", "currency": "EUR" }, { "eventID": "dc58b657-3d04-4dac-b2f8-c2448dbb7609" }); }); </script>
The same counts for “WooCommerce Google Analytics Pro”. Through E-Commerce tracking the plugin usually fires a event called “ga( ‘send’, {“hitType”:”event”,”eventCategory””…:
<script type="text/javascript"> jQuery(function($) { (function() { function trackEvents() { ga( 'send', 'pageview' ); ga( 'ec:addProduct', {"id":"101","name":"Product 1","brand":"","category":"123","variant":"50ml","price":"149","quantity":20,"position":""} );ga( 'ec:addProduct', {"id":"103","name":"Product 2","brand":"","category":"123","variant":"15ml","price":"69","quantity":4,"position":""} );ga( 'ec:addProduct', {"id":"#61627","name":"Product 3","brand":"","category":"Unkategorisiert","variant":"","price":"0.00","quantity":8,"position":""} );ga( 'ec:addProduct', {"id":"#67677","name":"Product 4","brand":"","category":"Unkategorisiert","variant":"","price":"0.00","quantity":8,"position":""} );ga( 'ec:addProduct', {"id":"102","name":"Product 5","brand":"","category":"123","variant":"3,5ml","price":"19","quantity":4,"position":""} );ga( 'ec:setAction', 'checkout', {"step":1,"option":"Registered User"} ); ga( 'send', {"hitType":"event","eventCategory":"Checkout","eventAction":"started checkout","eventLabel":null,"eventValue":null,"nonInteraction":true} ); // some other code ... } if ( 'undefined' !== typeof ga ) { trackEvents(); } else { // avoid using jQuery in case it's not available when this script is loaded document.addEventListener( 'wc_google_analytics_pro_loaded', trackEvents ); } })(); }); </script>
Both code blocks are injected correctly on the regular checkout page! They both are injected through javascript I believe.
Anyhow, we are not getting any errors in the developer console, but like I said on the Klarna checkout page the codes are not getting injected, on the regular checkout page it works fine whatsoever.
Also we have already switched the theme to the default theme (Twenty Twenty)and the same issue occurs.I think that the Klarna checkout page is somehow blocking the scripts from being injected.
Could you please check?
Thank you!
- The topic ‘Events are not being tracked on the checkout page (Analytics, Facebook)’ is closed to new replies.