Hi,
This particular line is needed there so that if another plugin wants to push things to the dataLayer without checking its existence, there won’t be any error messages. I do this by adding a high priority number in the plugin to tell WordPress to include this line as soon as possible.
I could move it lower in the code but this would result in an error in some cases.
I would say if this is the only line to optimize on your site you should be already a winner 😉
Cheers,
Thomas
Hi Thomas,
Thanks for your response.
I understand your point. Though this is not the only page speed recommendation I see on GTMetrix, “ordering of script” is on the high priority list in which I thought I have some control and optimizing it will help me to get a step closer from becoming a “winner” 😉
If moving this script lower is not the right thing to do, is it possible to push the code further up? So that it doesn’t gets in between, external css and external JS (next resource)?
Cheers,
Venkat
Hi Venkat,
I am going to check what could be done.
I am not sure it is possible to move everything in that way.
What if I would include a checkbox on the “Advanced” tab? If you check it the plugin wouldn’t add high priority for the dataLayer declaration thus there won’t be any “gap” between the mentioned line and the other script parts?
Thomas
Hi Thomas,
Great plugin, thank you. I am not sure whether I had the same issue as above. I run google PageSpeed test on my site and I found a line related to the plugin in the
should fix session” for eliminating render-blocking JavaScript
Is there any solution for this?
Thank you,
Gellert