@igorkba opened this issue on June 19th 2015

Hi folks, I'm software developer(mobile applications) and I'm new in the piwik. Our company has decided to replace from Google Analytics to Piwik, but we found some problems. Piwik track approximately only half of Ecommerce items like google analytics. for example: GA 10 000 ecommerce items and piwik only 5 000 ecommerce items. I have created a special tracking code that detects these users. Here is our javascript settings, piwik settings and part of devices which piwik doesn't track: piwik: -piwik version: latest -Do Not Track support: disabled javascript(our application required that all user must enabled javascript): -bootstrap: when DOM ready:

try {
     _paq = _paq || [];
    _paq.push(['setSiteId', app.options.siteId]); // for example - 2
    _paq.push(['setTrackerUrl', 'https://some_adress/piwik.php']);
    _paq.push(['enableLinkTracking']);
    }
    catch (e) {
        if (typeof ga != 'undefined') {
        var message = e.name + ' | ' + e.message + ' | ' + e.stack + ' | ' + navigator.userAgent + + ' || time - ' + Date();
        ga('send', 'event', 'piwik-error', 'bootstrap', message, null);
    }
    }

track ecommerce:

if (typeof _paq != 'undefined') {
    try {
        _paq.push(['setUserId', skuKod]); // 124789
        _paq.push(['trackPageView']);       
        _paq.push(['addEcommerceItem',
            skuKod, // 124789
            gaProductName, // some string
            gaCategory, // some string
            total, // number
            1 // always 1
        ]);
        _paq.push(['trackEcommerceOrder',
            idTrans, // unix time stamp
            total // number
        ]);
        console.log('_addItem', idTrans, skuKod, gaProductName, gaCategory, total);
    } catch (e) {
        ga('send', 'event', 'piwik-error', 'utils', 'userID' + '-' + skuKod + ':' + e.name + ' | ' + e.message + ' | ' + e.stack + ' | ' + navigator.userAgent + ' || time - ' + Date(), null);
    }
}

piwik.js - I a little changed it(only try catch bock for error tracking to GA) and included to our all.js javascript file(Adblock hide etc), because at first I thought that some users blocking piwik.js. link on piwik.js: http://www.fileshare.sk/shares/cp6ihuopr/piwik.js From GA: _paq object exists and no piwik error. Part of devices which piwik no tracking(_it looks only Android and only Chrome problems_):

  • Sony D2203, Android 4.4.2, Chrome 35.0.1916.141, user agent - Mozilla/5.0 (Linux; Android 4.4.2; D2203 Build/18.4.C.1.36) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.141 Mobile Safari/537.36
  • Samsung GT-S7580 Trend Plus, Android 4.2.2, Chrome 34.0.1847.114, user agent - Mozilla/5.0 (Linux; Android 4.2.2; GT-S7580 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36
  • Samsung SM-G357FZ, Android 4.4.4, Chrome 43.0.2357.93, user agent - Mozilla/5.0 (Linux; Android 4.4.4; SM-G357FZ Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36
  • Sony C5303 Xperia SP, Android 4.1.2, Chrome 35.0.1916.138, user agent - Mozilla/5.0 (Linux; Android 4.1.2; C5303 Build/12.0.A.1.257) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.138 Mobile Safari/537.36
  • Samsung GT-P3100 Galaxy Tab 2 7.0, Android 4.1.2, Chrome 43.0.2357.93, user agent - Mozilla/5.0 (Linux; Android 4.1.2; GT-P3100 Build/JZO54K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Safari/537.36
  • Sony D6503 Xperia Z2, Android 5.0.2, Chrome 39.0.2171.93, user agent - Mozilla/5.0 (Linux; Android 5.0.2; D6503 Build/23.1.A.1.28) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36
  • Feiteng GT-i9300, Android 4.3, Chrome 43.0.2357.93, user agent - Mozilla/5.0 (Linux; Android 4.3; GT-I9300 Build/JSS15J) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36
  • Sony D6503 Xperia Z2, Android 5.0.2, Chrome 39.0.2171.93, user agent - Mozilla/5.0 (Linux; Android 5.0.2; D6503 Build/23.1.A.1.28) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36
  • Samsung GT-I9195 Galaxy S4 Mini, Android 4.2.2, Chrome 18.0.1025.308, user agent - Mozilla/5.0 (Linux; Android 4.2.2; sk-sk; SAMSUNG GT-I9195/I9195XXUBML4 Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Version/1.0 Chrome/18.0.1025.308 Mobile Safari/535.19
  • Sony LT25i Xperia V, Android 4.3, Chrome 43.0.2357.93, user agent - Mozilla/5.0 (Linux; Android 4.3; LT25i Build/9.2.A.2.5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36
  • Sony D2303 Xperia M2, Android 4.4.4, Chrome 43.0.2357.93, user agent - Mozilla/5.0 (Linux; Android 4.4.4; D2303 Build/18.3.1.C.1.15) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36
  • Sony LT30p Xperia T, Android 4.0.4, Chrome 41.0.2272.96, user agent - Mozilla/5.0 (Linux; Android 4.0.4; LT30p Build/7.0.A.3.223) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36
  • Samsung GT-I9505 Galaxy S IV, Android 4.4.2, Chrome 28.0.1500.94, user agent - Mozilla/5.0 (Linux; Android 4.4.2; sk-sk; SAMSUNG GT-I9505 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36
  • Sony D2005 Xperia E1, Android 4.4.2, Chrome 34.0.1847.114, user agent - Mozilla/5.0 (Linux; Android 4.4.2; D2005 Build/20.1.A.2.13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36 ...

thx,

Igor

@mattab commented on June 22nd 2015

Hi @igorkba Thanks for the report. When you post the error events to GA with var message = e.name + ' | ' + e.message + ' | ' + e.stack + ' | ' + navigator.userAgent + + ' || time - ' + Date(); -> can you list here the messages you get logged from GA? Maybe there are some interesting message such as JS error message or other problem?

We need to get to the bottom of this issue and understand why some of your data is not tracked in Piwik. thanks for sending us more info!

@igorkba commented on June 22nd 2015

Hi @mattab for 4 days no piwik error in GA, it looks like some logical problem in piwik.js, not fatal. The problematic devices looks Samsung and specially Sony with Google Chrome browser. We ordered for testing one of problematic device: Sony Xperia M2 (D2303) and I wil try debug it and fix it. I'll let know what I found. A method that track GA + piwik together:

utils.register('addTrans', function (idTrans, skuKod, gaProductName, total, quantity, gaCategory) {
    var showUserInfo = function showUserInfo() {        
        var userInfo = 'userID - ' + skuKod + ' || user agent - ' + navigator.userAgent + ' || cookieEnabled - ' + navigator.cookieEnabled + ' || time - ' + Date();
        return userInfo;
    };
    if (ga) {
        try {
            ga('ecommerce:addTransaction', {
                'id': idTrans,                  // Transaction ID. Required
                'affiliation': '',              // Affiliation or store name
                'revenue': total               // Grand Total
            });
            ga('ecommerce:addItem', {
                'id': idTrans,                     // Transaction ID. Required
                'name': gaProductName,                // Product name. Required
                'sku': skuKod,                    // SKU/code
                'category': gaCategory,       // Category or variation
                'price': total,                 // Unit price
                'quantity': '1'                   // Quantity
            });
            ga('ecommerce:send');
        } catch (e) {
            //eat exception
        }
    }
    if(typeof _paq != 'undefined') {
        utils.trackEvent('Add Transaction - success', showUserInfo()); // track event to GA
    }
    else {
        utils.trackEvent('Add Transaction - fail', showUserInfo()); // track event to GA
    }
    if (typeof _paq != 'undefined') {
        try {
            _paq.push(['setUserId', skuKod]);
            _paq.push(['trackPageView']);            
            _paq.push(['addEcommerceItem',
                skuKod, // (required) SKU: Product unique identifier
                gaProductName, // (optional) Product name
                gaCategory, // (optional) Product category.
                total, // (recommended) Product price
                1 // (optional, default to 1) Product quantity
            ]);
            _paq.push(['trackEcommerceOrder',
                idTrans,
                total
            ]);
            console.log('_addItem', idTrans, skuKod, gaProductName, gaCategory, total);
        } catch (e) {            
            ga('send', 'event', 'piwik-error', 'utils', 'userID' + '-' + skuKod + ':' + e.name + ' | ' + e.message + ' | ' + e.stack + ' | ' + navigator.userAgent + ' || time - ' + Date(), null);
        }
    }
});

No 'Add Transaction - fail' event in the GA(only success) and all users has cookieEnabled - true.

@mattab commented on June 24th 2015

We ordered for testing one of problematic device: Sony Xperia M2 (D2303) and I wil try debug it and fix it. I'll let know what I found.

Thanks for this, it's great to hear you're investigating. let us know what you find and when we can help

@igorkba commented on June 25th 2015

Good news piwik team, problem detected and solved. I have debugged Sony Xperia and I got this error: net::ERR_INSECURE_RESPONSE when ajax call piwik.php. What happened: Gogle in a last versions of Google Chrome for mobile implemented more secure restrictions for SSL certificate like for desktop browser. Our Piwik application runs on another computer with another SSL certificate like our mobile application. Both certificates are trusted. We just changed only the SSL certificate chain for computer where piwik runs and voilĂ , piwik works great. Great job piwik team, we have now more precise results from Piwik as the GA. Thank you @mattab for you effort and you can close this and remove from bugs, because it was our problem.

Igor

@sgiehl commented on June 25th 2015

Ok. Thanks for the update

@mattab commented on June 25th 2015

Follow up to share this knowledge in a FAQ: Document the possible issue with data not being tracked and SSL certificates / net::ERR_INSECURE_RESPONSE #8220

This issue was closed on June 25th 2015
Powered by GitHub Issue Mirror