Skip to content

No multi currency support in google analytics module #7471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sam-g-roberts opened this issue Nov 17, 2016 · 5 comments
Closed

No multi currency support in google analytics module #7471

sam-g-roberts opened this issue Nov 17, 2016 · 5 comments
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: needs update

Comments

@sam-g-roberts
Copy link

There is currently no support for multi currency in the magento google analytics module. It's a 1 minute change and should really be included as default as most stores will use Google analytics and if they have multiple currencies not having multicurrency support will skew their data.

In the google analytics module block Ga.php the below needs to be changed from

            $result[] = sprintf(
                "ga('ec:setAction', 'purchase', {
                    'id': '%s',
                    'affiliation': '%s',
                    'revenue': '%s',
                    'tax': '%s',
                    'shipping': '%s'
                });",
                $order->getIncrementId(),
                $this->escapeJsQuote($this->_storeManager->getStore()->getFrontendName()),
                $order->getBaseGrandTotal(),
                $order->getBaseTaxAmount(),
                $order->getBaseShippingAmount()
            );

to

            $result[] = sprintf(
                "ga('ec:setAction', 'purchase', {
                    'id': '%s',
                    'affiliation': '%s',
                    'revenue': '%s',
                    'tax': '%s',
                    'shipping': '%s',
                    'currency': '%s'
                });",
                $order->getIncrementId(),
                $this->escapeJsQuote($this->_storeManager->getStore()->getFrontendName()),
                $order->getBaseGrandTotal(),
                $order->getBaseTaxAmount(),
                $order->getBaseShippingAmount(),
                $order->getOrderCurrencyCode()
            );
@sam-g-roberts sam-g-roberts changed the title No multi currency in google analytics module No multi currency support in google analytics module Nov 17, 2016
@veloraven
Copy link
Contributor

@sam-g-roberts thank you for your feedback.
Please, format this issue according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result.
Please, also identify which version of Magento you are running.

@sam-g-roberts
Copy link
Author

Magento version is github develop version

You haven't included the google analytics multi currency paramater when sending off a conversion to google analytics.

In this file https://github.com/magento/magento2/blob/develop/app/code/Magento/GoogleAnalytics/Block/Ga.php

lines 130-143 need to be replaced with the below code

$result[] = sprintf(
                "ga('ec:setAction', 'purchase', {
                    'id': '%s',
                    'affiliation': '%s',
                    'revenue': '%s',
                    'tax': '%s',
                    'shipping': '%s',
                    'currency': '%s'
                });",
                $order->getIncrementId(),
                $this->escapeJsQuote($this->_storeManager->getStore()->getFrontendName()),
                $order->getBaseGrandTotal(),
                $order->getBaseTaxAmount(),
                $order->getBaseShippingAmount(),
                $order->getOrderCurrencyCode()
            );

This means when orders in different currencies go through to google analytics they will not get put in as those different currencies

@veloraven
Copy link
Contributor

@sam-g-roberts thank you for update.
But I have to ask you once more to describe this issue according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result.
You can leave the description and previous comment as they contain valuable information. But please add one more comment with exact steps to reproduce the issue instead of how to fix it.
Like:
Steps:

  1. Do this action as admin
    ...
  2. Do that action as customer
    ...
  3. Check these values ...

Actual result:

  • values are ...

Expected Result:

  • values shoukd be ...

@vzabaznov
Copy link
Contributor

closed as we don't receive update more than 2 week, @sam-g-roberts please feel free to write here/reopen or to open new issue

@magento-team magento-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development develop labels Aug 16, 2017
@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-71539

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: needs update
Projects
None yet
Development

No branches or pull requests

4 participants