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

Please dont overwrite dataLayer in head. #32

Closed
AndreasGJ opened this issue Apr 21, 2020 · 3 comments
Closed

Please dont overwrite dataLayer in head. #32

AndreasGJ opened this issue Apr 21, 2020 · 3 comments

Comments

@AndreasGJ
Copy link

dataLayer = [{!! $dataLayer->toJson() !!}];

Please update the code to do a push instead, then we can attach other dataLayer related data before the head component - like Google Optimize and more. I would also like to setup data in the dataLayer before the GTM is started rendering directly in the layout file.

dataLayer.push( {!! $dataLayer->toJson() !!} ); 
@spatie-bot
Copy link

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

@tdondich
Copy link

@AndreasGJ one way you can do this, which I've done is simply override the vendor view files for the head blade template and inserted google optimize code after the dataLayer definition. Works like a charm. So this is totally doable.

@FrittenKeeZ
Copy link
Contributor

@AndreasGJ I've finally added a PR (#40) for this fix :D

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

No branches or pull requests

4 participants