• Resolved danielsps

    (@danielsps)


    Hello,

    I see that there are already many topics on gtm4wp.orderCompletedEEC not firing, but I couldn’t find my problem.

    My problem is that gtm4wp.orderCompletedEEC fires correctly, but only if the payment method is Direct Bank Transfer or Cash on Delivery. When using payment gateway (we are using Klix https://developers.klix.app/) gtm4wp.orderCompletedEEC will not fire after a successful purchase.
    This leads me to believe that if the purchase happens off-site then gtm4wp.orderCompletedEEC will not be fired.

    Do you have ideas on how to fix this?

    Thank you`

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Same issue, please help.

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    Does your payment gateway force users to get back to your order received page?
    Or your customers can leave the funnel after payment without getting back to the order received page of the order?

    Thread Starter danielsps

    (@danielsps)

    It forces users to get back to the order received page.

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Can I go through the order process without the need to use my bank card and also without the need to grant me any kind of access? (perhaps some sort of test card data?)

    Thread Starter danielsps

    (@danielsps)

    Yes, I’ve created a test environment – https://beta.smilestory.lv/
    Test card:
    Issuer VISA
    PAN – 4314 2200 0000 0056
    CVV – 123
    Expiry date – 01/22

    Here is a products page for easier navigation – https://beta.smilestory.lv/product/elektriska-zobu-birste-oral-b-io-9-black-onyx/

    Checkout page – https://beta.smilestory.lv/samaksa/

    checkout looks like this https://drive.google.com/file/d/1ZYeJgZaylscuh0Dufgc2qU7rL7xSgvMo/view?usp=drivesdk

    Hi

    Have you guys figured this one out!? I’m having the same issues – using WordPress 5.9 and saying the plugin has not been tested with this version.

    I’ve also implemented the same tracking on another site with the previous version of the plugin and it worked perfectly.

    Please advise

    Kind Regards,

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    I was trying to pay with the test card data but it did not work twice:
    https://www.awesomescreenshot.com/image/21221981?key=03f37a80098abcab69abb2ed75ff70df

    Perhaps it is also important to fill the card holder with a specific value other than “Tests Test”?

    My dev site is running on WP 5.9, I haven’t seen any issues yet, I will update the tested version number soon.

    Thread Starter danielsps

    (@danielsps)

    Sorry for the late response. The payment getaways test cards expired. I tested again and was able to purchase products. Here are the credit card details for test cards https://developers.klix.app/test-environment/

    Please try to test it again.

    Thread Starter danielsps

    (@danielsps)

    Hello,

    Unfortunately, I haven’t heard anything from Thomas Geiger so I tried to fix the issue myself.
    I discovered that the thank you page was being loaded twice by the payment getaway which meant that GT4WP functions ran twice. First time adding “_ga_tracked” to order but not sending info to GA and second time not sending info because the order was already marked as tracked.

    This is the hack I came up with:

    add_action ('wp_head', 'action_wp_head', 5);
    function action_wp_head() {
        if (is_order_received_page()) {
            global $gtm4wp_options;
    
            $order_id = empty( $_GET['order'] ) ? ($GLOBALS['wp']->query_vars['order-received'] ?: 0) : absint($_GET['order'] );
            $order_id_filtered = apply_filters('woocommerce_thankyou_order_id', $order_id);
            if ('' != $order_id_filtered) {
                $order_id = $order_id_filtered;
            }
    
            $order_key = apply_filters('woocommerce_thankyou_order_key', empty($_GET['key']) ? '' : wc_clean( $_GET['key']));
    
            if ($order_id > 0) {
                $order = wc_get_order($order_id);
    
                if ($order instanceof WC_Order) {
                    $this_order_key = $order->get_order_key();
    
                    if ($this_order_key != $order_key) {
                        unset($order);
                    }
                } else {
                    unset($order);
                }
            }
    
            if(isset($order)){
                $payment_method = $order->get_payment_method();
    
                if($payment_method == 'klix_card'){
                    $ga_false_tracked = (int)get_post_meta($order_id, '_ga_false_tracked', true);
                    $ga_false_tracked++;
                    update_post_meta($order->get_id(), '_ga_false_tracked', $ga_false_tracked);
    
                    if($ga_false_tracked == 2){
                        update_post_meta( $order->get_id(), '_ga_tracked', 0 );
                    }
                }
            }
        }
    }

    I check if the payment method is credit card (klix_card) and if it is then remove ‘_ga_tracked’ the first time it is added.

    If anyone has a better way to fix this issue or improve my code, please share.

    Thank you,
    Daniels

    nichemimi

    (@nichemimi)

    I actually found this plugin! https://woocommerce.com/products/woocommerce-google-analytics/

    For me it was compatibility issues and the new versions of Wooccom and the GTM4WP plugin data points were not lining up!

    Works like a bomb and takes 2 mins to setup!

    hope it helps!

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi @danielsps,

    Sorry for not getting back to this thread in time.
    Your solution is interesting, if you do not mind, I would like to borrow the idea into the core to have an option in GTM4WP to skip the first tracking of the order.

    Thread Starter danielsps

    (@danielsps)

    Thanks @nichemimi for sharing your solution.

    Yes, if my code helps please use it to improve the plugins.

    Seems there are fixes to this issue and an official solution is being worked on. I’m closing down the thread.

    Anonymous User 15878740

    (@anonymized-15878740)

    Dear @duracelltomi

    We had exactly the same issue as the author of this topic. We tried the solution provided by danielsps and managed to improve the tracking of conversion but the difference between Google and our data is still some 30%.

    Three months ago, you wrote that you would take the idea of danielsps to the core. We had a hope that it would improve our situation. Could you please tell us whether you made these adjustments to the plugin.

    Thank you (for the great plugin),

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘gtm4wp.orderCompletedEEC not firing using payment gateway’ is closed to new replies.