How to track Ecommerce for 2 GA accounts?

2 0 1

I added 1 GA via sjopify integration. I need send transaction information to one more GA account.


I had code that I was using previously but it is not helping me anymore:


(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

ga('create', 'UA-***', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', [''] );
ga('send', 'pageview');

ga('require', 'ecommerce', 'ecommerce.js')

var checkoutObj = window.Shopify.checkout,
lineItems = checkoutObj.line_items

if (checkoutObj)
// I'm using the checkout object to pull order-wide data.
// (you can find other available params in the Shopify JS API)
ga('ecommerce:addTransaction', {
'id': {{ order.order_number }},
'affiliation': '',
'revenue': {{ checkout.total_price | money_without_currency }},
'shipping': {{ shipping_method.price | money_without_currency }},
'tax': {{ tax_line.price | money_without_currency }}

if (lineItems)
for (var i = 0; i < lineItems.length; i++){
var line_item = lineItems[i]
// and I'm using the lineItem objects to get individual item data
// (you can find other available params in the Shopify JS API)
ga('ecommerce:addItem', {
'id': line_item.product_id,
'name': line_item.title,
'sku': line_item.sku,
'category': '',
'price': line_item.price,
'quantity': line_item.quantity

// ayy, send the data we we're trying to get!
ga('send', 'event', 'Ecommerce Amienaturals', 'Purchase')


Replies 0 (0)