Analytics
2.3K members online now
Understand information in your reports and troubleshoot reporting issues such as self-referrals, (not set) data, and inaccurate information
 
Guide Me
star_border
Reply

Missing Random Ecomerce Transactions

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I'm getting a problem in google analytic sales performance report not update, please check below the analytic code which we use in our magento website.

some times google analytic update order in sales performance or some times not update. Please help me.

Our website URL : http://www.grotekadoshop.nl/

<?php
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$total = $order->getGrandTotal();
$shipping = $order->getShippingAmount();
$tax = $order->getTaxAmount();
$store = Mage::app()->getStore();
$name = $store->getName();

$items = $order->getAllItems();
$item_details = array() ;
foreach($items as $item) {
$det = array() ;
$det['sku'] = $item->getSku() ;
$det['name'] = $item->getName() ;
$det['category'] = get_category_name($item->getProductId()) ;
$det['price'] = $item->getPrice() ;
$det['quantity'] = number_format($item->getQtyOrdered(), 0) ;
array_push($item_details, $det) ;

}

function get_category_name($productId) {
$product = Mage::getModel('catalog/product')->load($productId);
$category_name = "" ;
$cats = $product->getCategoryIds();

$cnt = 0 ;
foreach ($cats as $category_id) {
$_cat = Mage::getModel('catalog/category')->load($category_id) ;
$cnt++ ;
if($cnt == count($cats))
$category_name.=$_cat->getName() ;
else
$category_name.=$_cat->getName()."," ;
}
return $category_name ;
}

function getItemJs(&$transId, &$item) {
return <<<HTML
ga('ecommerce:addItem', {
'id': '$transId',
'name': '{$item['name']}',
'sku': '{$item['sku']}',
'category': '{$item['category']}',
'price': '{$item['price']}',
'quantity': '{$item['quantity']}'
});
HTML;
}

?>

<script type="text/javascript">

ga('require', 'ecommerce', 'ecommerce.js'); // Load GA ecommerce plug-in.
ga('ecommerce:addTransaction', {
'id': '<?php echo $this->getOrderId(); ?>', // Transaction ID. Required
'affiliation': '<?php echo $name ?>', // Affiliation or store name
'revenue': '<?php echo $total; ?>', // Grand Total
'shipping': '<?php echo $shipping; ?>', // Shipping
'tax': '<?php echo $tax; ?>' // Tax
});
// to get items
<?php
foreach ($item_details as &$item) {
echo getItemJs($this->getOrderId(), $item);
}
?>
ga('ecommerce:send');
</script>

Below the code which i have generated from analytics. please check and help me.

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-69928016-1', 'auto');
ga('send', 'pageview');

</script>

1 Expert replyverified_user

Re: Missing Random Ecomerce Transactions

Rising Star
# 2
Rising Star
Hi Depinder S,

Pasting your code here is not going to help. What you need to do is an analysis on all the transactions that are not tracking. Take your backend data and see if you can find any commonality. Perhaps an apostrophe in the product name etc which could cause a JavaScript error. Once you have a profile of what is not collecting; run test transactions and look for errors in the developers console, in your transaction and product arrays or in Tag Assistant.

Tag Assistant:
https://chrome.google.com/webstore/detail/tag-assistant-by-google/kejbdjndbnbjgmefkgdddjlbokphdefk?h...

Hope that helps.

Best,

Theo Bennett
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Missing Random Ecomerce Transactions

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Theo B,

Thank you for your reply.
I have install this extension in chrome then i found there, https:// missing in google analytic. I fix this but still i have not received transaction in sales performance report. In our website we use two language one is English & another is Dutch, when we order from English website then sometimes transaction updated or sometimes not updated in google sales performance report.
Other side when we ordered from dutch website then transaction not updated in google sales performance report. Please help me what can i do for fix this problem.

Thank You,
Depinder Singh

Re: Missing Random Ecomerce Transactions

Rising Star
# 4
Rising Star
Hi Depinder,

Since Ecommerce requires developers to dynamically pass the information into the GATC, it's often a development problem that hasn't addressed some unique feature of your site or product catalog and there really isn't one way to go about correcting it when you have a problem.

You really need to look at the transactions that don't make it in for commonalities. You can also do tests and save the source code of the receipt page. You are looking for a transaction and a separate product array.

You can also use the record feature of Tag Assistant to help and or use GA Debug and the dev console in chrome to make things a little easier to see.

https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna...

Good luck!

Best,

Theo Bennett
.
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Missing Random Ecomerce Transactions

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Hi Theo B,

I have use the record feature of Tag Assistant and i have found below the details :

Recording Summary

Google Tag Assistant Recording tracked 8 pages and 2 hits.

We noticed 1 Google Analytics Account. To view a more detailed report about your Analytics account, click on the relevant account:

UA-69928016-1

Recorded Pages

Pageload 1: Grote Kadoshop: Het online Cadeau Warenhuis

URL : http://www.grotekadoshop.nl/

Redirect : http://grotekadoshop.nl/

Time : Jul 22, 2016 10:23:28 AM

Page Load : 1.34 s

Tags : 2 in Total

1. Google Analytics UA-69928016-1

2. Google Tag Manager GTM-M8CKXG

Pageload 2: BARBECUE / BBQ | Camping | TUIN & CAMPING | HOME

URL : http://www.grotekadoshop.nl/tuin-camping/camping/barbecue-bbq

Time : Jul 22, 2016 10:23:46 AM (17 seconds after Pageload 1)

Page Load : 5.20 s

Tags : 2 in Total

2 Suggestions

1. Google Analytics UA-69928016-1

2. Google Tag Manager GTM-M8CKXG

Pageload 3: Tristar bq-2811 elektronische barbecue

URL : http://www.grotekadoshop.nl/tristar-bq-2811-elektronische-barbecue

Time : Jul 22, 2016 10:23:52 AM (6 seconds after Pageload 2)

Page Load : 2.87 s

Tags : 2 in Total

1. Google Analytics UA-69928016-1

2. Google Tag Manager GTM-M8CKXG

Pageload 4: Winkelmandje

URL : http://www.grotekadoshop.nl/checkout/cart/

Redirect : http://www.grotekadoshop.nl/checkout/cart/add/uenc/aHR0cDovL3d3dy5ncm90ZWthZG9zaG9wLm5sL3RyaXN0YXItY...

Time : Jul 22, 2016 10:23:59 AM (6 seconds after Pageload 3)

22-7-2016 chrome-extension://kejbdjndbnbjgmefkgdddjlbokphdefk/templates/recordings.html#/record

Page Load : 3.18 s

Tags : 2 in Total

1. Google Analytics UA-69928016-1

2. Google Tag Manager GTM-M8CKXG

Pageload 5: Winkelmandje

URL : http://www.grotekadoshop.nl/checkout/cart/

Redirect : http://www.grotekadoshop.nl/checkout/cart/couponPost/

Time : Jul 22, 2016 10:24:10 AM (11 seconds after Pageload 4)

Page Load : 2.84 s

Tags : 2 in Total

1. Google Analytics UA-69928016-1

2. Google Tag Manager GTM-M8CKXG

Pageload 6: Winkelmandje

URL : http://www.grotekadoshop.nl/checkout/cart/

Redirect : http://www.grotekadoshop.nl/checkout/cart/couponPost/

Time : Jul 22, 2016 10:24:40 AM (30 seconds after Pageload 5)

Page Load : 3.14 s

Tags : 2 in Total

2 Suggestions

1. Google Analytics UA-69928016-1

2. Google Tag Manager GTM-M8CKXG

Pageload 7: One Step Checkout

URL : http://www.grotekadoshop.nl/onestepcheckout/

Time : Jul 22, 2016 10:24:45 AM (5 seconds after Pageload 6)

Page Load : 2.75 s

Tags : 2 in Total

1. Google Analytics UA-69928016-1

2. Google Tag Manager GTM-M8CKXG

22-7-2016 chrome-extension://kejbdjndbnbjgmefkgdddjlbokphdefk/templates/recordings.html#/record

Pageload 8: Grotekadoshop.nl

URL : http://www.grotekadoshop.nl/checkout/onepage/success/?___SID=U

Redirect : http://www.grotekadoshop.nl/onestepcheckout/

Time : Jul 22, 2016 10:25:39 AM (53 seconds after Pageload 7)

Page Load : 7.46 s

Tags : 2 in Total

1. Google Analytics UA-69928016-1

Web Property ID UA-69928016-1

Code Version/Syntax Universal

Protocol version number1

...

ga ( 'create' , 'UA-69928016-1' , 'auto' );

ga ( 'send' , 'pageview' );

//]]>

_ga GA1.2.1148119513.1467983633

_gat 1

Pageview Requests

1 Pageview

Title Grotekadoshop.nl

URL http://www.google-analytics.com/collect?v=1&_v=j44&a=331240640&t=pageview&_s=1&dl=http://www.groteka...

Redirected URL https://www.google-analytics.com/collect?v=1&_v=j44&a=331240640&t=pageview&_s=1&dl=http://www.grotek...

2. Google Tag Manager GTM-M8CKXG

Account ID GTM-M8CKXG

Check Contained Tags

&lt;script async= "" src="//www.googletagmanager.com/gtm.js?id=GTM-M8CKXG" > &lt;/script&gt;

dataLayer [

{

"transactionId" : "800004255" ,

"transactionDate" : "2016-07-22" ,

"transactionTotal" : 5.95 ,

"transactionShipping" : 4.92 ,

"transactionTax" : 7.71 ,

"transactionPaymentType" : "No Payment Information Required" ,

"transactionCurrency" : "EUR" ,

"transactionShippingMethod" : "categoryshipping" ,

"transactionPromoCode" : "JeffreyTest100" ,

"transactionProducts" : [

{

"name" : "Tristar BQ-2811 Elektronische Barbecue" ,

"sku" : "XI-BQ-2811" ,

"category" : "TUIN & CAMPING|Camping|Barbecue / BBQ" ,

"price" : 31.82 ,

"quantity" : 1

}

],

"visitorLoginState" : "Logged out" ,

"visitorType" : "NOT LOGGED IN" ,

"visitorLifetimeValue" : 0 ,

"visitorExistingCustomer" : "No"

},

{

22-7-2016 chrome-extension://kejbdjndbnbjgmefkgdddjlbokphdefk/templates/recordings.html#/record

"gtm.start" : 1469175946065 ,

"event" : "gtm.js"

},

{

"event" : "gtm.dom"

},

{

"event" : "gtm.load"

}

]

http://www.googletagmanager.com/gtm.js?id=GTM-M8CKXG

Please check and let me know if there's issue ?

Thank You,
Depinder Singh

Re: Missing Random Ecomerce Transactions

Rising Star
# 6
Rising Star
Hi Depinder,

Do you see this transaction in your GA reports?

Best,

Theo
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Missing Random Ecomerce Transactions

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
Hi Theo,

I have not receive any transaction in GA reports.

Thank You,
Depinder Singh

Re: Missing Random Ecommerce Transactions

Rising Star
# 8
Rising Star
Any or some? I thought you were seeing some. It can take 24 hours for ecommerce transactions to show. So this one is not in the reports?


Best,

Theo Bennett
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Missing Random Ecommerce Transactions

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭
My last order which i receive in 13 July is shown in GA report. After this date i have not receive any order in GA report.

Thank You,
Depinder Singh

Re: Missing Random Ecommerce Transactions

[ Edited ]
Rising Star
# 10
Rising Star

Hi Depinder,

So it's not random transactions missing, your ecommerce stopped working after July 13? When you played back the recording and Tag Assistant showed you what would be reported, did it show the transactions?

If you didn't do that, you may want to test again. Since you are using GTM, make sure your tag is configured properly - did you make any changes on 13 July? This time, also use GA debug for chrome and watch the developers console to make sure you see the transaction and product array without error.

 

Edit: adding link for ga debug:

 

https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna...

You may also want to use dataSlayer which can help you see what is happening as well.

https://chrome.google.com/webstore/detail/dataslayer/ikbablmmjldhamhcldjjigniffkkjgpo?hl=en

We're looking to see if the ecom hit was formed properly and made it to the account you posted here.

Best,

Theo

Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn