AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
4K members online now
4K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

eCommerce dataLayer + VirtualPageview = ....no data, no tags, nothing at all.

Follower ✭ ✭ ☆
# 1
Follower ✭ ✭ ☆

Hello hivemind!

I'm not a dev but I'm in charge of setting up our analytics, so this might be a super basic question sorry!

 

I'm setting up eCommerce for a SPA. I'm using VirtualPageview events to track my pages, and it's all working perfectly EXCEPT on the order confirmation page. None of my tags are firing on the order confirmation page. The tags are triggered by the virtual pageviews, so I reckon the problem must be there..only I don't know enough javascript to know what it could be! The only difference between this page and all my other 'pages' is the existence of the eCommerce dataLayer, if that helps?

 

This is the code my devs have done (except with our container code in there):

 

</head>

<body>


<script type="text/javascript">
dataLayer.push({
'event':'VirtualPageview',
'virtualPageURL':'/confirmation',
'virtualPageTitle':'Confirmed'
});
dataLayer = [{
'transactionId': '90000000-1', // Transaction ID - TypeSmiley Frustratedtring - Required
'transactionTotal': '6.50', // Total revenue - Type:Numeric - Required
'transactionTax': '0.60', // Tax amount for transaction - Type:Numeric - Optional to use
'transactionPromoCode': '', // Promotional or Discount code used - TypeSmiley Frustratedtring - Optional to use
'transactionProducts':
[
{
'sku': 'TST9999', // Product SKU - TypeSmiley Frustratedtring - Required
'name': 'Test Online Special', // Product Name - TypeSmiley Frustratedtring - Required
'category': 'Testing', // Product Category - TypeSmiley Frustratedtring - Optional to use
'price': '6.00', // Product Price - Type:Numeric - Required
'quantity': '1' // Product Quantity - Type:Numeric - Required
}

]
}];
</script>



<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-xxxxxx"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

 

 

 

 

Any ideas?

Re: eCommerce dataLayer + VirtualPageview = ....no data, no tags, nothing at all.

[ Edited ]
Follower ✭ ✭ ☆
# 2
Follower ✭ ✭ ☆

Hi Alex

 

I recommend you that following code. In the following code, the code is push to the dataLayer variable all at the same time.

 

<script type="text/javascript">
dataLayer.push({
  'event':'VirtualPageview',
  'virtualPageURL':'/confirmation',
  'virtualPageTitle':'Confirmed',
  'transactionId': '90000000-1', // Transaction ID - Typetring - Required
  'transactionTotal': '6.50', // Total revenue - Type:Numeric - Required
  'transactionTax': '0.60', // Tax amount for transaction - Type:Numeric - Optional to use
  'transactionPromoCode': '', // Promotional or Discount code used - Typetring - Optional to use
  'transactionProducts': [
    {
      'sku': 'TST9999', // Product SKU - Typetring - Required
      'name': 'Test Online Special', // Product Name - Typetring - Required
      'category': 'Testing', // Product Category - Typetring - Optional to use
      'price': '6.00', // Product Price - Type:Numeric - Required
      'quantity': '1' // Product Quantity - Type:Numeric - Required
    }
  ]
}];
</script>

 

Thanks, Ryota. YAMADA.. 

Re: eCommerce dataLayer + VirtualPageview = ....no data, no tags, nothing at all.

Follower ✭ ✭ ☆
# 3
Follower ✭ ✭ ☆

Hi Ryota, we have implemented as per your post and unfortunately there is still no data coming through. See below:

 

 

<script type="text/javascript">
                        dataLayer.push({
                          'event':'VirtualPageview',
                          'virtualPageURL':'confirmation',
                          'virtualPageTitle':'Confirmed',
                          'transactionId': '90000000-1', // Transaction ID - Type:String - Required
                          'transactionTotal': 6.50, //total revenue - Type:Numeric - Required
                          'transactionTax': 0.60, // Tax amount for transaction - Type:Numeric - Optional to use
                          'transactionPromoCode': , // Promotional or Discount code used - Type:String - Optional to use
                          'transactionProducts': [
                            {
                              'sku': 'TST1111', // Product SKU - Type:String - Required
                              'name': 'Test Online Special', // Product Name - Type:String - Required
                              'category': 'Test',  // Product Category - Type:String - Optional to use
                              'price': 6.00, // Product Price - Type:Numeric - Required
                              'quantity': 1 // Product Quantity - Type:Numeric - Required
                            }
                          ]
                        }];
                        </script>
 
	
	<!-- Google Tag Manager (noscript) -->
	<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-xxxxxx"
	height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
	<!-- End Google Tag Manager (noscript) -->

 

 

 

In debug, I get this for every other page:

STANDARD_DEBUG.PNG

 

And this for the confirmation page:

CONFIRMATION_DEBUG.PNG

 

 

The VirtualPageview tag that works fine on every other page is fired by code like the below, if it helps:

</head>

<body>
	<script type="text/javascript">
			   dataLayer.push({
			      'event':'VirtualPageview',
			      'virtualPageURL':'/find',
			      'virtualPageTitle':'Find'
			});
	</script>
	
	<!-- Google Tag Manager -->
	<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-xxxxxx"
	height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
	<!-- End Google Tag Manager (noscript) -->

 

Hopefully his makes sense!