My site tracks pageviews using Google Tag Manager and downloads the advanced e-commerce plugin on some pages using ga('require', 'ec'), but there is an error:
Uncaught ReferenceError: ga undefined
Code snippet:
ga('require', 'ec');
function onProductClick(product, url, key) {
ga('ec:addProduct', {
'id': "'" + product.product_id + "'",
'name': product.model_name,
'category': product.series_name + '/' + product.dealer_name,
'brand': product.brand_name,
'variant': product.model_name,
'position': key
});
What is wrong with him?
source
share