Giter VIP home page Giter VIP logo

Comments (5)

dneustadt avatar dneustadt commented on June 11, 2024

Hello uehler,

you accurately described one of the major hurdles when it comes to developing plugins for Shopware. The usual solution to this problem is to use the cache-breaking widget controllers. As you may know, I recently added a feature to add modules for custom dataLayers. I just released a new version that now supports widget controllers as custom modules.

In the following example we want to track the first name of the logged in customer. As a "carrier" for dataLayer push we will use the checkout/info endpoint. First, make sure that the endpoint is not being cached. So possibly remove from widgets/checkout controller from the cached controller list. Add a new module with the key widgets_checkout_info. Afterwards you can go ahead and configure the dataLayer for the new module. To get an idea of the variables you can use within the dataLayer see the template of the endpoint under themes/Frontend/Bare/widgets/checkout/info.tpl

checkout_info

The dataLayer push for widget views will be prepended directly before the corresponding markup, so it possibly won't be part of the first push within the head tag but will appear wherever the widget was inserted. I hope this helps.

I won't upload that new version the Shopware Community Store just now. It would help a lot if you would be willing to give this a try first and tell me if this version solved the issue.

from wbmtagmanager.

uehler avatar uehler commented on June 11, 2024

ok great, we will test it on monday and give you feedback

from wbmtagmanager.

uehler avatar uehler commented on June 11, 2024

Hi @dneustadt,

I just tested your changes and it looks good so far, but there are a lot of executions of the window.dataLayer.push on detail and listing (screen from detail)

bildschirmfoto 2018-10-16 um 15 38 47 1

In our custom theme its even worse.

I did the same steps like you and tested Shopware 5.2.27 with custom theme based on the bootstrap theme and Shopware 5.3.7 with default theme

from wbmtagmanager.

dneustadt avatar dneustadt commented on June 11, 2024

Thanks for the feedback. I just drafted a new release (still 3.2.0) that includes according changes. That should fix the issue with identical dataLayer tags being prepended on multiple Widget PostDispatch events.

from wbmtagmanager.

uehler avatar uehler commented on June 11, 2024

yes, that problem is fixed

thank you very much!

from wbmtagmanager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.