We have setup Google Analytics Ecommerce Tracking through Google Tag Manager.
Code:
$tracking_script = "
dataLayer.push({
'transactionId': '$ref',
'transactionAffiliation': '$cartec_name',
'transactionTotal': '$amount',
'transactionTax': '',
'transactionShipping': '',
'transactionProducts': [{
'sku': 'DD-{$amount}-{$currency}',
'name': '{$cartec_name}_Deposit',
'category': '',
'price': '$amount',
'quantity': 1
}],
'event': 'deposit_successful'
});
";
<script type="text/javascript">
if (typeof(dataLayer) !== 'undefined') {
<?php echo $tracking_script; ?>
}
</script>
Tracking works but we have about 200 (30%) transactions missing per day compared to our database records.
What are the possible causes and what are the best methods for debugging this problem?