Try to Track ECommerce in custom platform


(Wai-Sun Chia) #1

I’m trying to embed eCommerce tracking in my customer marketplace platform. I have tried the sample addEcommerceItem, trackEcommerceOrder and trackPageView, and it worked once, last week.

This week, I tried to expand it, the code no longer worked; i.e. there is no more update. Anything wrong with the code below?

Each item is like this:
{“id”:745,“name”:“Gloink - Samsung MLT D116L Compatible Toner Cartridge”,“category”:1,“price”:11200,“quantity”:“1”}

                r.matomo.forEach(function(item) {
                    _paq.push(['addEcommerceItem',
                        item.id,
                        item.name,
                        item.category,
                        item.price/100,
                        item.quantity
                    ]);
                });  

                _paq.push(['trackEcommerceOrder',
                    "ABCD1234", 35, 30, 5.5, 4.5, false
                ]);  

                _paq.push(['trackPageView']);


(Wai-Sun Chia) #2

trackEcommerceOrder is hardcoded just for testing. I’m happy just to see the transaction is logged, but alas that is not the case.


(Wai-Sun Chia) #3

DEBUG: Debug enabled - Input parameters:
DEBUG: array (
DEBUG: ‘{“requests”:_"?idsite’ => ‘1’,
DEBUG: ‘url’ => ‘https://foobarmart.com/cart’,
DEBUG: ‘action_name’ => ‘Ecommerce Tracking’,
DEBUG: ‘_id’ => ‘8973’,
DEBUG: ‘apiv’ => ‘1’,
DEBUG: ‘idgoal’ => ‘0’,
DEBUG: ‘ec_id’ => ‘1’,
DEBUG: ‘ec_items’ => ‘{“id”:745,“name”:“Foo - Samsung MLT D116L Compatible Toner Cartridge”,“category”:1,“price”:112,“quantity”:“1”}’,
DEBUG: ‘revenue’ => ‘112’,
DEBUG: ‘ec_st’ => ‘113’,
DEBUG: ‘ec_tx’ => ‘7’,
DEBUG: ‘ec_sh’ => ‘7.5’,
DEBUG: ‘ec_dt’ => ‘5.4’,
DEBUG: ‘_ects’ => ‘1512057600’,
DEBUG: ‘rec’ => ‘1"]}’,
DEBUG: )
{“status”:“success”,“tracked”:0,“invalid”:0}

Anything wrong with the above?
And why is it tracked:0??