What is Magento Ecommerce?
Magento is an open-source e-commerce platform written in PHP for e-commerce web sites.
Magento is the provider of two distinct platforms, Magento Community Edition and Magento Enterprise Edition.
Magento Community Edition is an open-source content-management system. Fitted with bundle of features, anyone can modify the core system of Community version. Developers can implement the core files and extend its functionality by adding new plug-in modules provided by other developers.
How to add Google Analytics e-commerce tracking in Magento
Magento have too many commonly added features, Google API is one of them. To add Google Analytics on Magento you can use Google API module .
Steps to add Google Analytics e-commerce in Magento using Google API:
- Login to Magneto admin panel
- Go to system -> configurations.
- Click on Google API.
- Select yes in drop down and place UA Id (UA-XXXXXX-XX) in below given box and save it
By adding Google Analytics using Google API, Google Analytics e-commerce will be enable.
Steps to add Google Analytics e-commerce in Magento using FTP:
- Login to FTP.
- Open footer.phtml (file path: app->design->frontend-> yourPackage->yourTheme->template->checkout->success.phtml).
- Add the below code( for Universal Analytics) in bottom of success.phtml.
<?php $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId()); $subtotal = $order->getSubtotal(); $order_id = $order->getId(); //the id of the order //$order->getIncrementId();//the increment id of the order $gtotal = $order->getGrandTotal();//grand total of the order $address = $order->getBillingAddress()->getData(); $city = $address['city']; $state = $address['region']; $country = $address['country_id']; ?> <script type="text/javascript"> ga('require', 'ecommerce'); ga('ecommerce:addTransaction', { 'id': '<?php echo $order_id; ?>', // Transaction ID. Required. 'affiliation': '', // Affiliation or store name. 'revenue': '<?php echo $gtotal;?>', // Grand Total. 'shipping': '0', // Shipping. 'tax': '0' // Tax. }); <?php $items = $order->getAllItems(); $itemcount=count($items); $name=array(); $unitPrice=array(); $sku=array(); $ids=array(); $qty=array(); foreach ($items as $itemId => $item) {?> ga('ecommerce:addItem', { 'id': '<?php echo $order_id; ?>', // Transaction ID. Required. 'name': '<?php echo $item->getName(); ?>', // Product name. Required. 'sku': '<?php echo $item->getSku(); ?>', // SKU/code. 'category': '', // Category or variation. 'price': '<?php echo $item->getPrice(); ?>', // Unit price. 'quantity': '<?php echo $item->getQtyToInvoice(); ?>' // Quantity. }); <?php } ?> ga('ecommerce:send'); </script>
- Save and upload success.phtml file on server.
Note :- Above mentioned code will work on Magento 1.x. and before editing any file on server, please keep back up of file.
You can definitely see your skills in the work you write. The world hopes for even more passionate writers like you who are not afraid to say how they believe. Always follow your heart.
I’ve been surfing online more than 2 hours today, yet I never found any interesting article like yours.
It is pretty worth enough for me. In my opinion,
if all site owners and bloggers made good content as you did, the internet will
be much more useful than ever before.