问题
So basicly i'm trying to get custom variables trough to google analytics panel while using ecommerce extension. My main goal is to give every item a set of custom values.
My "code" looks like this:
ga('require', 'ecommerce');
ga('ecommerce:addTransaction', {
'id': 'id',
'affiliation': 'affiliation',
});
ga('ecommerce:addItem', {
'id': 'id',
'name': 'Loan - name',
'sku': '{RIDA:success_loan_id}',
'loanSumEur': 'Sum',
'loanSumLit': 'Sum LTL',
'loanLength': 'length',
'loanData': 'data'
});
ga('ecommerce:send');
ga('ecommerce:clear');
How should I declare those loanSumEur, loanSumLit, loanlength, loanData variables so Google would pass them trough to the google analytics admin panel. Is it even possible ?
It's quite easy to declare custom variables for site tracking, however I got a little bit stuck trying to do the same thing on transaction items.
BR's
回答1:
Yes, it is possible using custom dimensions & metrics.
ga('ec:addProduct', { // Provide product details in an productFieldObject.
'id': 'P12345', // Product ID (string).
'name': 'Powerup', // Product name (string).
'category': 'Extras', // Product category (string).
'variant': 'red', // Product variant (string).
'price': '10.00', // Product price (currency).
'quantity': 2, // Product quantity (number).
'dimension4': 'strong', // Product-scoped custom dimension (string).
'metric2': 5 // Product-scoped custom metric (integer).
});
ga('ec:setAction', 'purchase', {
'id': 'T12345',
'revenue': '20.00'
});
ga('send', 'pageview'); // Send transaction data with initial pageview.
See : Custom Dimensions & Metrics - Product-level scope
来源:https://stackoverflow.com/questions/27821900/is-it-possible-to-send-custom-variables-to-google-analytics-while-using-ecommerc