• I installed your gtm4wp plugin for a website this past Friday to use with GTM in search of more accurate Analytics data without duplicate conversions appearing. I saw you have built in some functionality for that and believe I have it configured correct.

    Over the weekend we experienced 3 out of 10 transactions that still had conversion revenue doubled up. The exit page pageviews for the these order-received pages also showed these as twice viewed.

    These 3 orders were placed on mobile devices.

    Is it possible this plugin by WooCommerce which modifies our order numbers, (WooCommerce Sequential Order Numbers Pro) could affect the transaction ID that is being checked against for duplilcates? https://docs.woocommerce.com/document/sequential-order-numbers/

    Any other ideas? The website with this issue is beveragelements.com

    Thank you,
    Chris

    —————- Here is gtm4wp view-source of original order-received page—————————-

    <!– Google Tag Manager for WordPress by gtm4wp.com –>
    <script data-cfasync=”false” data-pagespeed-no-defer type=”text/javascript”>//<![CDATA[
    var google_tag_params = {“pagePostType”:”page”,”pagePostType2″:”single-page”,”pagePostAuthor”:”Beverage Elements”,”browserName”:”Chrome”,”browserVersion”:”76.0.3809.132″,”browserEngineName”:”Blink”,”browserEngineVersion”:””,”osName”:”Windows”,”osVersion”:”10.0″,”deviceType”:”desktop”,”deviceManufacturer”:””,”deviceModel”:””,”customerTotalOrders”:0,”customerTotalOrderValue”:”0.00″,”customerFirstName”:””,”customerLastName”:””,”customerBillingFirstName”:””,”customerBillingLastName”:””,”customerBillingCompany”:””,”customerBillingAddress1″:””,”customerBillingAddress2″:””,”customerBillingCity”:””,”customerBillingPostcode”:””,”customerBillingCountry”:””,”customerBillingEmail”:””,”customerBillingPhone”:””,”customerShippingFirstName”:””,”customerShippingLastName”:””,”customerShippingCompany”:””,”customerShippingAddress1″:””,”customerShippingAddress2″:””,”customerShippingCity”:””,”customerShippingPostcode”:””,”customerShippingCountry”:””,”cartContent”:{“totals”:{“applied_coupons”:[],”discount_total”:0,”subtotal”:0,”total”:0},”items”:[]},”ecommerce”:{“currencyCode”:”USD”,”purchase”:{“actionField”:{“id”:”19272″,”affiliation”:””,”revenue”:7.5,”tax”:0.51,”shipping”:4.39,”coupon”:””},”products”:[{“id”:489,”name”:”CO2 Tank Leak Stopper Permanent O-Ring”,”sku”:”CO2LEAKSTOPPER”,”category”:”Cylinder Parts and Accessories”,”price”:2.59,”currency”:”USD”,”stocklevel”:460,”quantity”:1}]}},”event”:”gtm4wp.orderCompletedEEC”,”ecomm_prodid”:[489],”ecomm_pagetype”:”purchase”,”ecomm_totalvalue”:2.59};
    var dataLayer_content = {“visitorType”:”visitor-logged-out”,”visitorIP”:”24.230.147.50″,”pagePostType”:”page”,”pagePostType2″:”single-page”,”pagePostAuthor”:”Beverage Elements”,”browserName”:”Chrome”,”browserVersion”:”76.0.3809.132″,”browserEngineName”:”Blink”,”browserEngineVersion”:””,”osName”:”Windows”,”osVersion”:”10.0″,”deviceType”:”desktop”,”deviceManufacturer”:””,”deviceModel”:””,”customerTotalOrders”:0,”customerTotalOrderValue”:”0.00″,”customerFirstName”:””,”customerLastName”:””,”customerBillingFirstName”:””,”customerBillingLastName”:””,”customerBillingCompany”:””,”customerBillingAddress1″:””,”customerBillingAddress2″:””,”customerBillingCity”:””,”customerBillingPostcode”:””,”customerBillingCountry”:””,”customerBillingEmail”:””,”customerBillingPhone”:””,”customerShippingFirstName”:””,”customerShippingLastName”:””,”customerShippingCompany”:””,”customerShippingAddress1″:””,”customerShippingAddress2″:””,”customerShippingCity”:””,”customerShippingPostcode”:””,”customerShippingCountry”:””,”cartContent”:{“totals”:{“applied_coupons”:[],”discount_total”:0,”subtotal”:0,”total”:0},”items”:[]},”ecommerce”:{“currencyCode”:”USD”,”purchase”:{“actionField”:{“id”:”19272″,”affiliation”:””,”revenue”:7.5,”tax”:0.51,”shipping”:4.39,”coupon”:””},”products”:[{“id”:489,”name”:”CO2 Tank Leak Stopper Permanent O-Ring”,”sku”:”CO2LEAKSTOPPER”,”category”:”Cylinder Parts and Accessories”,”price”:2.59,”currency”:”USD”,”stocklevel”:460,”quantity”:1}]}},”event”:”gtm4wp.orderCompletedEEC”,”ecomm_prodid”:[489],”ecomm_pagetype”:”purchase”,”ecomm_totalvalue”:2.59,”google_tag_params”:window.google_tag_params};
    // if dataLayer contains ecommerce purchase data, check whether it has been already tracked
    if ( dataLayer_content.transactionId || ( dataLayer_content.ecommerce && dataLayer_content.ecommerce.purchase ) ) {
    // read order id already tracked from cookies
    var gtm4wp_orderid_tracked = “”;
    var gtm4wp_cookie = “; ” + document.cookie;
    var gtm4wp_cookie_parts = gtm4wp_cookie.split( “; gtm4wp_orderid_tracked=” );
    if ( gtm4wp_cookie_parts.length == 2 ) {
    gtm4wp_orderid_tracked = gtm4wp_cookie_parts.pop().split(“;”).shift();
    }

    // check enhanced ecommerce
    if ( dataLayer_content.ecommerce && dataLayer_content.ecommerce.purchase ) {
    if ( gtm4wp_orderid_tracked && ( dataLayer_content.ecommerce.purchase.actionField.id == gtm4wp_orderid_tracked ) ) {
    delete dataLayer_content.ecommerce.purchase;
    } else {
    gtm4wp_orderid_tracked = dataLayer_content.ecommerce.purchase.actionField.id;
    }
    }

    // check standard ecommerce
    if ( dataLayer_content.transactionId ) {
    if ( gtm4wp_orderid_tracked && ( dataLayer_content.transactionId == gtm4wp_orderid_tracked ) ) {
    delete dataLayer_content.transactionId;
    delete dataLayer_content.transactionDate;
    delete dataLayer_content.transactionType;
    delete dataLayer_content.transactionAffiliation;
    delete dataLayer_content.transactionTotal;
    delete dataLayer_content.transactionShipping;
    delete dataLayer_content.transactionTax;
    delete dataLayer_content.transactionPaymentType;
    delete dataLayer_content.transactionCurrency;
    delete dataLayer_content.transactionShippingMethod;
    delete dataLayer_content.transactionPromoCode;
    delete dataLayer_content.transactionProducts;
    } else {
    gtm4wp_orderid_tracked = dataLayer_content.transactionId;
    }
    }

    if ( gtm4wp_orderid_tracked ) {
    var gtm4wp_orderid_cookie_expire = new Date();
    gtm4wp_orderid_cookie_expire.setTime( gtm4wp_orderid_cookie_expire.getTime() + (365*24*60*60*1000) );
    var gtm4wp_orderid_cookie_expires = “expires=”+ gtm4wp_orderid_cookie_expire.toUTCString();
    document.cookie = “gtm4wp_orderid_tracked=” + gtm4wp_orderid_tracked + “;” + gtm4wp_orderid_cookie_expire + “;path=/”;
    }

    }
    dataLayer.push( dataLayer_content );//]]>
    </script>
    <script data-cfasync=”false”>//<![CDATA[
    (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:
    new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src=
    ‘//www.googletagmanager.com/gtm.’+’js?id=’+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,’script’,’dataLayer’,’GTM-W29H59F’);//]]>
    </script>
    <!– End Google Tag Manager –>
    <!– End Google Tag Manager for WordPress by gtm4wp.com –>

    ———— here is view-source of when I reloaded the order-received page in a new tab ———————–

    <!– Google Tag Manager for WordPress by gtm4wp.com –>
    <script data-cfasync=”false” data-pagespeed-no-defer type=”text/javascript”>//<![CDATA[
    var google_tag_params = {“pagePostType”:”page”,”pagePostType2″:”single-page”,”pagePostAuthor”:”Beverage Elements”,”browserName”:”Chrome”,”browserVersion”:”76.0.3809.132″,”browserEngineName”:”Blink”,”browserEngineVersion”:””,”osName”:”Windows”,”osVersion”:”10.0″,”deviceType”:”desktop”,”deviceManufacturer”:””,”deviceModel”:””,”customerTotalOrders”:0,”customerTotalOrderValue”:”0.00″,”customerFirstName”:””,”customerLastName”:””,”customerBillingFirstName”:””,”customerBillingLastName”:””,”customerBillingCompany”:””,”customerBillingAddress1″:””,”customerBillingAddress2″:””,”customerBillingCity”:””,”customerBillingPostcode”:””,”customerBillingCountry”:””,”customerBillingEmail”:””,”customerBillingPhone”:””,”customerShippingFirstName”:””,”customerShippingLastName”:””,”customerShippingCompany”:””,”customerShippingAddress1″:””,”customerShippingAddress2″:””,”customerShippingCity”:””,”customerShippingPostcode”:””,”customerShippingCountry”:””,”cartContent”:{“totals”:{“applied_coupons”:[],”discount_total”:0,”subtotal”:0,”total”:0},”items”:[]}};
    var dataLayer_content = {“visitorType”:”visitor-logged-out”,”visitorIP”:”24.230.147.50″,”pagePostType”:”page”,”pagePostType2″:”single-page”,”pagePostAuthor”:”Beverage Elements”,”browserName”:”Chrome”,”browserVersion”:”76.0.3809.132″,”browserEngineName”:”Blink”,”browserEngineVersion”:””,”osName”:”Windows”,”osVersion”:”10.0″,”deviceType”:”desktop”,”deviceManufacturer”:””,”deviceModel”:””,”customerTotalOrders”:0,”customerTotalOrderValue”:”0.00″,”customerFirstName”:””,”customerLastName”:””,”customerBillingFirstName”:””,”customerBillingLastName”:””,”customerBillingCompany”:””,”customerBillingAddress1″:””,”customerBillingAddress2″:””,”customerBillingCity”:””,”customerBillingPostcode”:””,”customerBillingCountry”:””,”customerBillingEmail”:””,”customerBillingPhone”:””,”customerShippingFirstName”:””,”customerShippingLastName”:””,”customerShippingCompany”:””,”customerShippingAddress1″:””,”customerShippingAddress2″:””,”customerShippingCity”:””,”customerShippingPostcode”:””,”customerShippingCountry”:””,”cartContent”:{“totals”:{“applied_coupons”:[],”discount_total”:0,”subtotal”:0,”total”:0},”items”:[]},”google_tag_params”:window.google_tag_params};
    // if dataLayer contains ecommerce purchase data, check whether it has been already tracked
    if ( dataLayer_content.transactionId || ( dataLayer_content.ecommerce && dataLayer_content.ecommerce.purchase ) ) {
    // read order id already tracked from cookies
    var gtm4wp_orderid_tracked = “”;
    var gtm4wp_cookie = “; ” + document.cookie;
    var gtm4wp_cookie_parts = gtm4wp_cookie.split( “; gtm4wp_orderid_tracked=” );
    if ( gtm4wp_cookie_parts.length == 2 ) {
    gtm4wp_orderid_tracked = gtm4wp_cookie_parts.pop().split(“;”).shift();
    }

    // check enhanced ecommerce
    if ( dataLayer_content.ecommerce && dataLayer_content.ecommerce.purchase ) {
    if ( gtm4wp_orderid_tracked && ( dataLayer_content.ecommerce.purchase.actionField.id == gtm4wp_orderid_tracked ) ) {
    delete dataLayer_content.ecommerce.purchase;
    } else {
    gtm4wp_orderid_tracked = dataLayer_content.ecommerce.purchase.actionField.id;
    }
    }

    // check standard ecommerce
    if ( dataLayer_content.transactionId ) {
    if ( gtm4wp_orderid_tracked && ( dataLayer_content.transactionId == gtm4wp_orderid_tracked ) ) {
    delete dataLayer_content.transactionId;
    delete dataLayer_content.transactionDate;
    delete dataLayer_content.transactionType;
    delete dataLayer_content.transactionAffiliation;
    delete dataLayer_content.transactionTotal;
    delete dataLayer_content.transactionShipping;
    delete dataLayer_content.transactionTax;
    delete dataLayer_content.transactionPaymentType;
    delete dataLayer_content.transactionCurrency;
    delete dataLayer_content.transactionShippingMethod;
    delete dataLayer_content.transactionPromoCode;
    delete dataLayer_content.transactionProducts;
    } else {
    gtm4wp_orderid_tracked = dataLayer_content.transactionId;
    }
    }

    if ( gtm4wp_orderid_tracked ) {
    var gtm4wp_orderid_cookie_expire = new Date();
    gtm4wp_orderid_cookie_expire.setTime( gtm4wp_orderid_cookie_expire.getTime() + (365*24*60*60*1000) );
    var gtm4wp_orderid_cookie_expires = “expires=”+ gtm4wp_orderid_cookie_expire.toUTCString();
    document.cookie = “gtm4wp_orderid_tracked=” + gtm4wp_orderid_tracked + “;” + gtm4wp_orderid_cookie_expire + “;path=/”;
    }

    }
    dataLayer.push( dataLayer_content );//]]>
    </script>
    <script data-cfasync=”false”>//<![CDATA[
    (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:
    new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src=
    ‘//www.googletagmanager.com/gtm.’+’js?id=’+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,’script’,’dataLayer’,’GTM-W29H59F’);//]]>
    </script>
    <!– End Google Tag Manager –>
    <!– End Google Tag Manager for WordPress by gtm4wp.com –>

Viewing 15 replies - 1 through 15 (of 30 total)
  • Thread Starter dohman

    (@dohman)

    To clarify, the view-source code above is from a test order I just placed. I have not seen any duplicate conversion data for this order as of yet.

    Thank again,
    Chris

    Thread Starter dohman

    (@dohman)

    We are still having duplicate transactions come through, not a lot, but one or two every 20 to 30 orders. Earlier I thought they may have just occurred on mobile devices, but today I saw one attributed to a desktop user.

    I think I saw mention of a possible browser page restore triggering this, opposed to a page refresh. Do you have any insight how that would work? I tried test orders and have done intentional page reloads and refreshes on the tank you page trying to duplicate the duplication issue, but without success. I even opened the url on another device.

    Is there anyway incorporating a timestamp into your code could help things?

    thank you,

    Thread Starter dohman

    (@dohman)

    Update: I was able to produce duplicate transactions in GA when I ran another test order. The duplicate happened in GA when I left the thank you page open in the browser, closed the browser app leaving all my tabs as they were, then opened my browser app again which “restored” my tabs including the thank you page. I did not initiate a “refresh” or “reload” of the page at this point. It was just reopening the browser app with my thank you page tab still there and visible that produced the duplicates in GA.

    Later on, I did refresh/reload the page and that did not trigger any additional duplicates because of what I assume is the cookie doing its job in that case.

    We do have the latest version 1.10.1 of the GTM4WP plugin installed so I am confused why this is happening. My understanding is that the latest fix you implemented was to catch this type of scenario. I performed this test with a Chrome browser on a Pixel 3 device.

    Thank you for your help,

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi @dohman ,

    First of all: sorry for the radio silence.

    Thanks for the intensive testing.
    Indeed, that should be fixed by now as this is what we discovered with some other plugin users. The current approach is that GTM4WP places a 1st party cookie into the browser (on desktop and mobile devices as well) and if this cookie is present, ecommerce data will be removed from the dataLayer. This should work in your cases as well since the prevention mechanism is a JavaScript code included on each order received page. While the mobile browser is reopening your suspended tab, it does not reload the page but it executes the same JS codes. For the first time, this should pass transaction data to GTM (and GA). On the second run, it should not.

    I wonder if this is caused because the network request from the page to GA is also cached and re-run regardless of what JS codes are executing.

    Thread Starter dohman

    (@dohman)

    Hi Thomas. Thank you for your reply, I appreciate it greatly.

    We are running Autoptimize, and the shop cart/ checkout option is currently checked so it is running on those. It does not specifically state if the thank you page (order-received) is included in that, but maybe it is? Is this the type of caching you are referring to?

    thank you much,
    chris

    Plugin Author Thomas Geiger

    (@duracelltomi)

    No, I referred to browser caching.

    If you re-open your browser on your mobile device, it could happen that all network requests are executed again within the page.

    The hard thing is that I have a Nokia 9 currently and I was not able to reproduce this behavior yet, I left my phone locked for ~3-4 hours, reopened the browser but nothing has happened.

    This does not mean of course that you did not see this correctly it is “just” that I have currently some difficulties to have an exact way to reproduce your case which is mandatory for me to find a new fix

    Thread Starter dohman

    (@dohman)

    I am using Chrome browser. Are you using Chrome?

    I am able to duplicate this issue consistently by placing an order, waiting and hour, then reopening my browser with the thank page still in place.

    I set up GTM4WP on a test site and separate GA account and can also duplicate the issue. Our live site is using enhanced and the test site is tracking using the classic transaction data.

    The “Do not flag orders as being tracked” option in the GTM4WP integration settings is not checked. Can you confirm that is the correct setting?

    Thank you,

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Yes, this is the correct setting, thank you.

    And you check the duplicated order on the GA UI using the incoming data or Chrome’s network tab or a Chrome extension that show you the communication from your browser towards Google’s servers?

    Thread Starter dohman

    (@dohman)

    I have been seeing the duplicate transactions in the GA UI. I have not looked into network tab or ext when testing on my phone. What is the best way to do that?

    Would you like to try placing an order on my test site with your phone? The site is werpo.net/shop/ using the ‘test’ item. In my tests they do not duplicate when I reload/refresh my page, just when reopening the browser after 30 minutes. I believe 30 minutes is a default session time for GA, correct?

    What would suggest is the next step?

    thank you much for your help on this,
    chris

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi Chris,

    It turned out that there was an issue the the cookie expiration date.
    I have a new beta version released with some more fixes around this issue, can you test this on a test site?

    https://github.com/duracelltomi/gtm4wp/releases/tag/1.11beta1

    Thread Starter dohman

    (@dohman)

    hi Thomas,

    I’ll give that a shot here shortly and let you know how I come out.

    thanks,
    chris

    Thread Starter dohman

    (@dohman)

    i uploaded the files for 1.11 and ran another test order. an hour after the initial order, i reopened my browser with the checkout page still present. it created a duplicate transaction in GA.

    is there anything i should have reconfigured with this version? all i did was upload and replaced the old plugin files.

    is there any other information i can provide you with?

    i greatly appreciate your help. thank you,

    Plugin Author Thomas Geiger

    (@duracelltomi)

    could you use a USB cable to connect your phone to your desktop PC and use the remove debug feature of Chrome?

    https://developers.google.com/web/tools/chrome-devtools/remote-debugging

    I wonder what expiration date the cookie has now in your browser?
    I also wonder whether there is a new localStorage item with the latest order ID?

    Thread Starter dohman

    (@dohman)

    I’ll give this a shot and let you know what I find.

    thanks,

    Thread Starter dohman

    (@dohman)

    hi thomas,

    i connected to a mobile device to see the cookie info after placing another test order, and recreating a duplicate conversion by reopening the browser with the thank you page still in place.

    you can see an image of the cookie info at this url, https://werpo.net/wp-content/uploads/2019/11/cookies.jpg

    i am running gtm4wp v1.11. does this provide you with the info you were inquiring about?

    thanks,
    chris

Viewing 15 replies - 1 through 15 (of 30 total)
  • The topic ‘Trying to Track Down Cause of Duplicate Conversions’ is closed to new replies.