I use angulartics2 for tracking pageviews.
How I can track ecommerce:addItem
or ecommerce:addTransaction
by angulartics2 in angular 5 application?
Or maybe I can implement it more native?
p.s. I added ga('require', 'ecommerce');
For now, angulartics2 haven't an implementation of ecommerce tracking.
You can just use the global ga
function.
For example (and you can find native examples in Ecommerce Tracking):
(window as any).ga('ecommerce:addTransaction', {
'id': '1234', // Transaction ID. Required.
'affiliation': 'Acme Clothing', // Affiliation or store name.
'revenue': '11.99', // Grand Total.
'shipping': '5', // Shipping.
'tax': '1.29' // Tax.
});
and after all needed adds call ecommerce:send
by
(window as any).ga('ecommerce:send');