xyNNN / GoogleTagManagerBundle

Google Tag Manager Bundle for Symfony 2
https://github.com/xyNNN/GoogleTagManagerBundle
GNU Lesser General Public License v3.0
27 stars 15 forks source link

Separate helpers for head/body #8

Closed stefandoorn closed 7 years ago

stefandoorn commented 7 years ago

I'm just implementing GTM and their instructions are to put the JS part as high as possible inside the and the NOSCRIPT part directly inside the .

Currently all goes into the . I'm not sure how this affects performance, but I can imagine it does a bit. I haven't researched how easy it would be to split this up, but it might be a good add-on.

Latest instructions: https://developers.google.com/tag-manager/quickstart

xyNNN commented 7 years ago

Thanks you for contribution to make this bundle even better! Currently I'm very busy and if you want you can create a pull request to contribute to this bundle :) Otherwise I will try to review this issue or improvement and give you feedback as soon as possible :)

stefandoorn commented 7 years ago

Alright. I will see if I can find the time to create a PR. I'm also very busy, but maybe we can share a bit of the work.

Regarding how to do this, I'm thinking of adding another Twig Helper that does the part for the BODY and one for the part the HEAD. To avoid BC, we could name the one inside the HEAD different than now and keep the one in the BODY the same as now and put a parameter/flag or whatever to keep track of whether it has been set already.

But best would be to introduce BC and tag a new major of minor version I think after implementing this so we don't have to keep current flow too much.

I also read in the docs something interesting to work with environments inside Tag Manager, which could be interesting to add as Symfony also works a lot with environments. I have to dig into this.

What are your thoughts on the way of implementing this?

stefandoorn commented 7 years ago

Could you have a look into the previous comment? I can help to make some adjustments to the bundle, but it might also be worth using Symfony 3.x standards then for some things (e.g. Twig extension). I do see room for some improvements, but would like to know how ok it is for you to do breaking changes and e.g. push a new major release afterwards.