Since 100% of Google Analytics properties have now been transferred across to Universal Analytics, I suggest it would be a good time to look at
updating the Ecommerce Templates Parameters page explaining
how to track orders using Google Analytics.
Please do add your comments to this suggestion as you like.
------------------------------------------------------------
(1) ga.js is now obsoleteTherefore, please correct me if I am wrong, but both these
includes.php parameters are now also obsolete and
have no effect whatsoever.
$googleanalyticsinfo=true; // Obsolete
$usegoogleasync=true; // Obsolete------------------------------------------------------------
(2) What is written here applies to the thanks.php page onlyNow the only
includes.php parameter that you need is:
$usegoogleuniversal=true;(2a) In your Google Analytics Account, this requires:
ADMIN ... VIEW ... Ecommerce Settings ... Enable E-commerce =
ON(2b) On the
thanks.php page, in the
<body>, this
gathers all the Sales data and therefore must come first:
<?php include "vsadmin/inc/incthanks.php" ?>(2c) And further down, somewhere before the closing
</body> tag, you need this code which will
pass the Sales data through to Google Universal 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','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-Y', 'auto'); // Replace with your property ID
ga('send', 'pageview');
ga('require','ecommerce','ecommerce.js');
<?php print @$googleanalyticstrackorderinfo ?>
</script>(2d) Google Tag Manager code
cannot be used for this purpose.
(2e) You will not see the Sales data recorded in your Google Analytics Account until the following day.
------------------------------------------------------------
(3) Individual Product $Prices recorded as a sale should also include additional $ProductOption(s) orderedWhat happens now is that
incthanks.php passes on the $Price of each individual Product ordered. But the price for additional "Product Options" selected
does not get added to the base Product Price.
In Google Analytics, look at CONVERSIONS ... E-commerce ... Product Performance ... and check out the "
Product Revenue" column.
In my opinion the
incthanks.php equation for each individual item sale should be:
$ProductPrice + $OptionsSelectedTotal = $Product RevenueTotal
$Revenue recorded by Google Analytics is perfectly
correct and does include Product Options ordered.
------------------------------------------------------------
(4) Add another Parameter to automatically integrate Ecommerce Templates with Google Adwords Campaign ReportsThere have been Forum questions and discussion about how to intergrate ECT Shopping Cart sales performance into Google Adwords Campaign Reports:
https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=101352https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=108588Since use of Google Adwords is commonplace in online sales promotions, Ecommerce Templates software would be further enhanced if
incthanks.php included this capability.
------------------------------------------------------------
(5) Google Analytics Page View Tracking codeFor the website pages that you do wish to record visitor page view data (
other than thanks.php), the
Google Universal Analytics tracking javascript should be added near the top of the
<head> tag and before any other script or CSS tags.
<!-- 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', 'UA-XXXXX-Y', 'auto'); // Replace with your property ID
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->The
alternative async tracking snippet below adds support for preloading, which will provide a small performance boost on modern browsers, but can degrade to synchronous loading and execution on IE 9 and older mobile browsers that do not recognize the async script attribute.
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-XXXXX-Y', 'auto'); // Replace with your property ID
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics -->My testing confirms that alternative script does pass visit data through to Google Analytics exactly the same. I doubt there are more than a handful of visitors using outdated browsers like IE 9 these days.
Either script is fine and will work even if located before the closing
</body> tag. But near the top of the
<head> tag is the recommended place, inside an
Editable region so that you can pick and choose which pages you do (or do not) wish to track.
Google Tag Manager is another alternative you can use to record Page Views in Google Analytics.
Gary