Ecoomerce tracking are not displaying in google anayltic (Magento 2.2) - magento2.2

I have enabled the "Google Analytics" in magento 2 website(version 2.2.0) and also enabled the eCommerce setting google analytic but still no eCommerce related information displaying.
As I have investigate I found order tracking data always remain blank that is why no eCommerce information is displaying in google analytic.
"ordersTrackingData": <?= /* #escapeNotVerified */ json_encode($block->getOrdersTrackingData()) ?>,
But the issue if we resolve this, then information will start displaying only for success page because getOrdersTrackingData always check orderId (vendor\magento\module-google-analytics\Block\Ga.php).
$orderIds = $this->getOrderIds();
if (empty($orderIds) || !is_array($orderIds)) {
return;
}
How we can display analytic for product, cart and payment page? Is the feature is not available with default magento and do we need to add some other module for this.

This is magento 2.2 bug which is listed on github https://github.com/magento/magento2/issues/14951

Related

Add to Cart Button on CMS Page in Magento EE 1.13

I am trying to create a landing page for our company which runs on Magento Enterprise Edition 1.13. We use CMS pages for our landing pages and in the past we have been able to create custom add-to-cart buttons directly on the CMS page. It was very simple in fact, we would create a button and send the button to this URL endpoint:
<button class="button btn-cart" title="Add to Cart" onclick="setLocation('/n/magento/checkout/cart/add/product/644/qty/1')" type="button"><span><span>Add to Cart</span></span></button>
It was nice and simple and allowed us to really engage our visitors with awesome landing pages and the ability to add products to cart without leaving this highly optimized page.
You can read a StackOverflow post about the OLD way to do it here: Placing "Add to cart" button on homepage in Magento
However, this no longer works in Magento EE 1.13 according to Magento themselves.
I contacted our Magento support and explained to me that the syntax had changed, now requiring you to put your security hash in the URL. This seemed like a security concern to me, so I questioned it. I was then responded to stating that the security flaw was added to prevent developers from using this anymore without compromising their site. Essentially they are discouraging use of this. They said:
My developer indicated that the ability to add a product to the cart via a direct URL wasn't an intended functionality in Magento, and so the addition of the form_key value was meant to prevent its further use with the upgrade to 1.13.
So my question for all of you, is that if somoene wanted to create add-to-cart buttons on a CMS page, in order to add products without needing to send someone to a product page (where they would no longer be on our optimized landing page), how would I go about doing this?
Is there a way in Magento 1.13 to add a product to cart with a custom button that could be placed in custom HTML within a CMS page? Can this be done with a static block or widget? We really relied on this feature and are now questioning the purpose of Magento EE's $18K a year pricetag with this feature taken away. Please help, thanks!
You'll want to include the formkey block, and then use JavaScript to pull the value from the <input /> tag that is generated and add it to your link URLs, AJAX, etc.
{{block type="core/template" name="formkey" template="core/formkey.phtml"}}
This will work in 1.13:
<button onclick="location.href ='{{config path="web/unsecure/base_url"}}/checkout/cart/add?product=1&qty=1'">Add To Cart</button>
There is a way to modify magento code to allow adding products to shopping cart without form key.
I will post the solution, but anyway I want to warn you that removing form key validation will enable CSRF attacks on your customers!
You need to edit app\code\core\Mage\Checkout\controllers\CartController.php
Find next piece of code:
public function addAction()
{
if (!$this->_validateFormKey()) {
$this->_goBack();
return;
}
Comment first 3 lines of this function:
public function addAction()
{
//if (!$this->_validateFormKey()) {
// $this->_goBack();
// return;
//}
Now it is possible to use static links.

Bug in Promotional catalog price rules 1.8.0.0

Is there a bug in Magento 1.8.0.0 in the catalog pricing rules. I'm trying to get a data feed with the proper pricing but 1.8.0.0 spits out nothing whilst 1.8.1.0 gives me what I want.
$store_id = 1; // Use the default store
$discounted_price = Mage::getResourceModel('catalogrule/rule')->getRulePrice(
Mage::app()->getLocale()->storeTimeStamp($store_id),
Mage::app()->getStore($store_id)->getWebsiteId(),
Mage::getSingleton('customer/session')->getCustomerGroupId(),
$_product->getId());
// if the product isn't discounted then default back to the original price
echo $discounted_price;`
Unfortunately my development server is on 1.8.1.0 and my live site is running 1.8.0.0 can anyone suggest a fix. I should add the frontend prices and promotional prices are all being shown correctly, so the data is there somewhere, now at a loss as to where to retrieve it from.
It is a bug in Magento CE 1.8.0.0 and was fixed in 1.8.1.0
If you want only the fix instead of upgrading your live site, pls use this fix :
https://bitbucket.org/gferon/magento-1.8-catalogrule-fix/overview
Here's one more fix for applying existing rules on products.
http://www.techytalk.info/catalog-price-rules-not-being-applied-after-product-save-magento-ce-1-8-0-0/
Hope it helps you

How to use magento's native captcha for product review page and contact us form

In magento 1.7.0.2, a default captcha is available as out-of-box for only some forms like login, registration, checkout as guest only. But I want to use the same captcha for product review form also.
I have seen an extension which adds captcha for product review page, But it looks different from native captcha. If there are different no.of captcha's in one site, it doesnt looks good. So only I would like to add the native captcha for product review page and contact us page
Install the Product Review Captcha:
http://www.magentocommerce.com/magento-connect/7741.html
If you want to use only one type of captcha, you can install the free Fontis Recaptcha.
http://www.magentocommerce.com/magento-connect/fontis-recaptcha.html
Digital Pianism has developped an extension that implements the native Magento captcha on product review forms if you still need it.
You can find it here for now: https://www.magentocommerce.com/magento-connect/catalog/product/view/id/30268/
If the link dies, just google it ;)

Google Tag Manager Data Layer implementation and Magento Shop

I'm trying to connect Magento with Google Tag Manager, especially in order to track transactions and other e-commerce data in Google Analytics.
I installed this GTM Magento extension which is useful to add the GTM snippet at the right place and the GTM connection does work, but as you can see below transaction data is undefined - as no data layer is declared before the GTM snippet :
utmwv:5.4.1
utms:68
utmn:238730863
utmhn:127.0.0.1
utmt:tran
utmtid:undefined
utmtst:undefined
utmtto:undefined
utmttx:undefined
utmtsp:undefined
utmtci:undefined
utmtrg:undefined
utmtco:undefined
utmcs:UTF-8
utmsr:1280x800
utmvp:842x599
utmsc:24-bit
utmul:en-us
utmje:1
utmfl:11.7 r700
utmdt:Magento Commerce
utmhid:1296887870
utmr:0
utmp:/magento/index.php/checkout/onepage/success/
...
What I need now is to build and declare the GTM data layer before the GTM snippet into the /checkout/onepage/success page. Problem is I'm very new to Magento and I have no idea how to do this and I am looking for some help or tutorial dedicated to this kind of task.
If you are using magento and you want to implement conversion tracking or ecommerce tracking then it is not required to install any extension . you can directly implement GTM container code in Footer either Magento admin or using FTP.
Follow this link to get Total value http://www.notesonclick.com/blog/add-adwords-conversion-tracking-on-magento-with-conversion-value/
And add this code in success.phtml
<?php $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
$subtotal = $order->getSubtotal();
$gtotal = $order->getGrandTotal();
?>
<script>
var dataLayer=window.dataLayer||[];
dataLayer.push({'event':'order-placed','orderTotal':<?php echo $gtotal;?>,'orderSubTotal':<?php echo $subtotal;?>});
</script>
and for ecommerce Tracking Follow http://www.notesonclick.com/blog/add-google-analytics-ecommerce-tracking-in-magento/
Why not include the GTM snippet within the global template and trigger a given tag based on the URI?
I use the Aromicon extension for Universal Analytics which has the base eCommerce datalayer variables already created and ready to use out of the box.

Can Magento be used as a CMS to build a product catalog(not a store currently but maybe in the future)

I have to build a website for a mobile store. They want to list their products but don't want to start selling yet. I have done a lot of website with Joomla and Virtuemart.
This time I want to use Magento as they use Lightspeed a POS that offers integration with Magento community edition.
My question is can I simply use Magento as a CMS to only display products and a few static pages like about us etc. I went through stackoverflow and found that some members have recommended some good blog integrations for magento so that part is solved(Thanks :-) ).
I know I can use wordpress as a blog with magento.
I rephrase....Can I use it to simply display products!
If Yes then please let me know if I am doing it for the right reason.
the reason are:
Adding products and product information becomes very easy in a
shopping cart(But in a CMS like Joomla each page has to be literally "designed" or I will have to use CCK editor. It still
becomes difficult for the client to update products IMO)
It comes with built in plugins to show related/featured products
etc. with a click on a button or options in the backend while client
simply puts the appropriate tags(With a CMS have to use a plugin or
module in Joomla that has to be set to show in the particular pages)
Automatic display of images etc is easier in Magento in comparison
to a CMS like Joomla where I will have to use a plugin or a gallery
that is set to show inside an article
The buy/add to cart button can easily be disabled and a "more info"
button can be added that will send an email to the client. They get
the exact product code the customer is asking for(Doing that in
Joomla would require a lot of extra stuff like adding codes or use
an advanced contact form with a tag to be entered for each page)
Last but not the least when client is ready to go online it can
easily be converted
Does Magento have two display? One is simply a catalog and the other a store. I have seen that in some stores online(not necessarily using magento) I am assuming either they created a website with the products pages first and then added a store later.
But in many cases it looks like a part of the Shopping application.(i just can't seem to remember which one they were using now).
If Magento allows that then I think my problem is solved. I simply use the "catalog option" and when the client is ready for the store I simply pull the products using a extension from their POS software.
Thank you for taking the time to read/answer.
Using Magento as a catalog only without selling the items is pretty straightforward. The easiest thing to do is just to use the catalog category lists to list the products and just make sure the "order" button is not visible.
You can do this simply by removing it from the product detail template (and the list/grid template in case they have it).
Or you could (I think) set all products to 'out of stock' this will automatically remove the 'order' button.
If you want to be thorough you should edit the cartControllers's addAction to disable adding products to the cart.
If you are going to combine Magento with Wordpress, Fishpig has developed a plugin with which you can use shortcode within Wordpress blogposts or/and pages to display products.
More info about that can be found here: http://fishpig.co.uk/wordpress-integration/docs/shortcodes.html
System > Configuration > Advanced > Advanced
Disable the modules you don't want to use.
For example, if you wanted to use Magento as catalog only then disable sales module.
Hope this works for you!

Resources