Skip to content
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

Getting Javascript error while connecting GTM #2

Open
yaroslavbr opened this issue Jul 19, 2021 · 3 comments
Open

Getting Javascript error while connecting GTM #2

yaroslavbr opened this issue Jul 19, 2021 · 3 comments

Comments

@yaroslavbr
Copy link
Contributor

Summary
Getting this error in the console:

app.js?version=fda41c1c:180 jQuery.Deferred exception: Sibling component embeddedListComponent is required. Error: Sibling component embeddedListComponent is required.

Steps to reproduce

  1. Install GTM extension
  2. Configure it in the settings
  3. Go to the Front Store home page

Actual Result
Actual: Error on the home page.
Error: Rendering timeout for view of element: "//div[@id="container"]"

Expected Result
No errors.

Details about your environment
oro/commerce | 4.1.11 | OSL-3.0
oro/commerce-crm | 4.1.7 | OSL-3.0
oro/crm | 4.1.11 | OSL-3.0
oro/google-tag-manager-bundle | 4.1.7

  • PHP version: 7.4

I realize this issue may be related to the customization on the site. Maybe you can suggest something?

@Grygir
Copy link
Contributor

Grygir commented Jul 19, 2021

Hi @yaroslavbr ,

GTM bundle provides integration with several components such as home-page-slider, featured-products-list, new-arrivals-list, top-selling-list, related-products-list and upsell-products-list. Looks like some of those blocks are removed from your home page. To fix the issue you just need to find which functionality is missing and remove over layout update blocks with integration to GTM as well.

@yaroslavbr
Copy link
Contributor Author

@Grygir thank you very much, I will check

@chrisaligent
Copy link

chrisaligent commented Apr 4, 2022

For anyone else who comes across this issue, the solution is to create:
src/Acme/Bundle/ThemeBundle/Resources/views/layouts/blank/oro_frontend_root/disable_gtm.yml
(or place where appropriate in your codebase)

layout:
    actions:
        # We are not using these three homepage widgets but the GTM bundle adds tracking blocks
        # This causes an embeddedListComponent error on the homepage.
        # See: https://github.com/oroinc/google-tag-manager/issues/2
        # Remove the unnecessary GTM blocks
        - '@remove':
              id: featured_products_list_gtm
        - '@remove':
              id: new_arrivals_list_gtm
        - '@remove':
              id: top_selling_list_gtm

If like us, you found yourself in the unfortunate situation of needing to fix this the day before a launch, for the featured_products and new_arrivals blocks you can just edit the Segments (Featured Products and New Arrivals respectively) so they don't return any products. This will prevent the GTM layout blocks from being injected at all.
Unfortunately "Top Selling Products" (top_selling) isn't powered by a Segment, it's a non-functioning demo block which just returns the 10 newest products and needs to be removed on every Oro website.
It's powered by \Oro\Bundle\OrderBundle\Layout\DataProvider\TopSellingItemsProvider (which apparently needs to be customized or disabled on every Oro build).

Fortunately this site is hosted on OroCloud and supports patching, so we modified the TopSellingItemsProvider::getProducts() method to return an empty array and this prevents the GTM block from being injected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants