Reversing Google analytics ecommerce order and transaction - google-analytics

I am successfully using Google analytics ecommerce to track my orders/transactions but I am having difficulty reversing the test orders I have made. I have followed the instructions as per Google and created the following plain HTML page to run and counter these transactions:
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<title>Pilgrim 55</title>
<meta charset="UTF-8" />
<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-xxxxxxxxx-x', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<script>
ga('require', 'ecommerce', 'ecommerce.js');
ga('ecommerce:addTransaction', {
'id': '16',
'affiliation': 'Pilgrim 55',
'revenue': '-35.99',
'shipping': '0.00',
'tax': '0.00',
'currency': 'GBP'
});
ga('ecommerce:addItem', {
'id': '16',
'sku': 'p55serumfacialaloeretinol',
'name': 'Aloe Retinol Facial Serum',
'category': '',
'price': '35.99',
'quantity': '-1',
'currency': 'GBP'
});
ga('ecommerce:send');
ga('ecommerce:clear');
</script>
</body>
</html>
There are no js errors when I run this page. I have checked the transaction ID.
Basically, nothing happens in Google analytics.

Related

google analytics not showing numeric values

I am trying to send an event (with a numeric value) to google analytics but the numeric value is not being shown in google analytics dashboard:
<!-- Google Analytics -->
<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', 'XX-XXXXX-X', 'auto');
ga('send', 'pageview');
ga('send', {
hitType: 'event',
eventCategory: 'test',
eventAction: 'visit_on_page',
eventLabel: 'label2',
eventValue: Math.round(Math.random()*100)
});
You can find event value in Events report (not in Real time report).

Google Analytics ecommerce does not fire from local file

I am trying to set ecommerce tag firing from the local file. At the moment I am using hardcoded data.
The GA file itself is working and sending page view. However, the bit with ecommerce doesn't work. No information in the console, no errors like it doesn't exist.
The code is below:
<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-17316967-1', 'auto');
ga('set', 'checkProtocolTask', null); // Disable file protocol checking.
ga('set', 'checkStorageTask', null); // Disable cookie storage checking.
ga('set', 'historyImportTask', null); // Disable history checking (requires reading from cookies).
ga('send', 'pageview');
</script>
<script>
ga('require', 'ecommerce');
ga('ecommerce:addTransaction', {
'id' : '298',
'affiliation' : 'Tax',
'revenue' : '0.0',
'shipping' : '0.0',
'tax' : '0.0'
});
ga('ecommerce:addItem', {
'id' : '227',
'sku' : '227',
'name' : 'Alpha 0 featured listing',
'category': 'Appliances',
'price' : '23.34',
'quantity': 1
});
ga('ecommerce:send');
</script>

Google Enhanced ecommerce purchasing not logged

I am absolutely not enable to get Enhanced e-commerce working.
Please do not send be google tutorials I went like 10 times over them. (Please send me some tutorials for absolute dumb people how to set it really step by by step)
I am using a debugger and not seeing a thing.
NOTE: I can see a page view inside Google Analytics. But adding a item to a cart or purchasing a transaction I can not see inside Google analytics UI.
<head>
<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-XXXXXXX-1', 'auto'); // this is hidden UA
ga('send', 'pageview'); /*FIRST PAGE VIEW CALLED HERE */
ga('require', 'ec');
ga('ec:addProduct', { // Provide product details in an productFieldObject.
'id': 'P12345', // Product ID (string).
'name': 'Android Warhol T-Shirt', // Product name (string).
'category': 'Apparel', // Product category (string).
'brand': 'Google', // Product brand (string).
'variant': 'black', // Product variant (string).
'price': '29.20', // Product price (currency).
'coupon': 'APPARELSALE', // Product coupon (string).
'quantity': 1 // Product quantity (number).
});
ga('ec:setAction', 'purchase', { // Transaction details are provided in an actionFieldObject.
'id': 'T12345', // (Required) Transaction id (string).
'affiliation': 'Google Store - Online', // Affiliation (string).
'revenue': '37.39', // Revenue (currency).
'tax': '2.85', // Tax (currency).
'shipping': '5.34', // Shipping (currency).
'coupon': 'SUMMER2013' // Transaction coupon (string).
});
ga('send', 'pageview');
</script>
</head>
This si example from their tutorial. https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-transactions
I have got this code inside my head attribute.
Thanks for help.

Google Dynamic Remarketing tag not recognized

Trying to setup dynamic remarketing. Analytics and Adwords are linked and in use for some time now.
I modified the Analytics tag to require displayfeatures and set customer dimensions. I also added an extra event and pageview tag for testing purposes.
However, in adwords I get the message "We haven't detected the Google Analytics remarketing functionality on your website."
Below are the tags currently active on the site:
<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','//www.google-analytics.com/analytics.js','ga');
ga('create', 'XX-00000000-0', 'auto');
ga('require', 'displayfeatures');
ga('set', 'dimension1', 'FOOBAR1, FOOBAR2, FOOBAR3');
ga('set', 'dimension2', 'home');
ga('set', 'dimension3', '44.44, 55.55, 66.66');
ga('send', 'pageview');
</script>
<script type="text/javascript">
ga('send', 'event', 'product', 'view', {
'dimension1': 'FOOBAR4, FOOBAR5, FOOBAR6',
'dimension2': 'product',
'dimension3': '77.77, 88.88, 99.99'
});
</script>
<script type="text/javascript">
ga('send', 'pageview', {
'dimension1':'FOOBAR7, FOOBAR8, FOOBAR9',
'dimension2':'cart',
'dimension3':'11.11, 22.22, 33.33',
});
</script>
I had the same issue and brought on our Adwords rep to help mediate between GA. They claimed it may have something to do with the CMS, but nonetheless asked to try it out with Google Tag Manager.
Tried Google Tag Manager and the problem went away.

Google analytics ecommerce not tracking

I am trying to implement ecommerce tracking for a site i am working on but running into some problems. I have read the docs, debugged with the plugin for chrome, but I just can't seem to get it working.
This is the test code I have written (this will eventually be generated by PHP which isn't a problem):
<script type="text/javascript">
(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','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXX-X', 'auto');
ga('require', 'ecommerce', 'ecommerce.js');
ga('require', 'linkid', 'linkid.js');
ga('require', 'displayfeatures');
ga('send', 'pageview');
<?php
//log product details view
echo "ga('ecommerce:addTransaction', {
'id': 'P129945',
'affiliation': 'test item',
'revenue': '10.00',
'shipping': '5.00',
'tax': '1.00'
});";
echo "ga('ecommerce:addItem', {
'id': 'P129945',
'name': 'test item',
'category': 'Apparel',
'brand': 'abc',
'variant': 'red'
});";
echo "ga('ecommerce:send');";
?>
</script>
The analytics debugging tool shows all the transaction & item information and everything looks to be working, however nothing shows up in analytics. Other events are registered as normal. I also tried using the new enhanced ecommerce suite & commands but ran into the same problem.
Any help with this would be greatly appreciated!
Are you sure that ecommerce is enabled in the viewsettings? It's disabled by default.
Make sure you're using the 'raw' view. (Admin -> View -> RAW (from select field)).
There might be some filters applied, like IP exclusion (hides all transactions made from certain ip). There shouldn't be anything here by default, but if someone else was managing analytics before you, there might be.
Also, it may take up to 24 hours for the data to appear.

Resources