magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Fix issue #37348: Google GTag add ecommerce data fix.

Open Bashev opened this issue 2 years ago • 24 comments

  1. Currency was moved to order object.
  2. Escapers was changed to be in harmony of "non-deprecated" ones.

Description (*)

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes magento/magento2#37348

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

Contribution checklist (*)

  • [ ] Pull request has a meaningful description of its purpose
  • [x] All commits are accompanied by meaningful commit messages
  • [x] All new or changed code is covered with unit/integration tests (if applicable)
  • [ ] README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • [ ] All automated tests passed successfully (all builds are green)

Bashev avatar Apr 08 '23 10:04 Bashev

Hi @Bashev. Thank you for your contribution! Here are some useful tips on how you can test your changes using Magento test environment.

Add the comment under your pull request to deploy test or vanilla Magento instance:
  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

:exclamation: Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s) For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here :information_source: Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation. Join Magento Community Engineering Slack and ask your questions in #github channel.

m2-assistant[bot] avatar Apr 08 '23 10:04 m2-assistant[bot]

@magento run all tests

Bashev avatar Apr 08 '23 10:04 Bashev

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento run all tests

Bashev avatar Apr 08 '23 11:04 Bashev

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento run all tests

Bashev avatar Apr 08 '23 13:04 Bashev

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento run all tests

Bashev avatar Apr 08 '23 15:04 Bashev

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento run all tests

Bashev avatar Apr 13 '23 09:04 Bashev

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento run all tests

Bashev avatar Apr 13 '23 09:04 Bashev

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento run Sample Data Tests B2B, Sample Data Tests EE, Functional Tests B2B, Functional Tests EE, Integration Tests, Static Tests, Unit Tests, WebAPI Tests

Bashev avatar Apr 13 '23 14:04 Bashev

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@Bashev Appreciate the good work you are putting into this.

I have also looked into this and found that by including currency and changing the number values to be outputted correctly (removing quotation marks, following Google docs), Google now reads it as e-commerce data and includes it as revenue.

Which issues are you facing? I thought about creating a simple PR, but it looks like you are being more thorough and solving more things than me.

kasperth avatar Apr 18 '23 06:04 kasperth

@kasperth if currency is not on the order level GA not recognize order amount and everytime is reported as 0. When move the currency inside the order start working properly. Your finding is correct,. During the fix i add additional things as coupons and discounts into the datalayer which will be send to GA.

Unfortunately some of these changes reflect to changes of __construct of the Ga Block, composer.json and as result this is the reason for failed jobs.

Someone from the team need to support this PR.

Bashev avatar Apr 18 '23 06:04 Bashev

@Bashev I have a suggestion for your pull request. I can see that you are approaching two different things.

  1. Fixing the revenue tracking (by implementing the currency code).
  2. Enhancing and improving revenue tracking.

I suggest splitting this into two pull requests/issues, so these can be handled separately. This way, we can use the 1) fix for revenue as a patch, and shops can implement it ASAP, without having to rely on the improvements you are adding as well.

For example, we would like to use an official pull request to solve this using the patch module but are currently not able to, as we only need the currency fix. If we create our own PR with the currency fix, it will be closed as a duplicate.

I'll gladly assist in creating a PR with the currency code if you remove it from this one.

kasperth avatar May 01 '23 11:05 kasperth

@magento run all tests

Bashev avatar May 03 '23 20:05 Bashev

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@magento run Functional Tests B2B

Bashev avatar May 04 '23 04:05 Bashev

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

I have no idea how to solve this failing test, its only on B2B.

Bashev avatar May 04 '23 09:05 Bashev

already fixed, with some minor differences.

Bashev avatar Sep 13 '23 14:09 Bashev

@magento run all tests

engcom-Hotel avatar Jun 03 '24 12:06 engcom-Hotel

@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE, Static Tests, Unit Tests

engcom-Hotel avatar Jun 04 '24 05:06 engcom-Hotel

@magento run all tests

engcom-Echo avatar Jun 06 '24 04:06 engcom-Echo

@magento run all tests

engcom-Echo avatar Jun 06 '24 06:06 engcom-Echo

Fixed Unit test failures and other failing tests are not related to PR changes and some of them are known failure. Hence moving it to Pending Review

engcom-Echo avatar Jun 06 '24 10:06 engcom-Echo

@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE, WebAPI Tests

engcom-Hotel avatar Jun 07 '24 05:06 engcom-Hotel