-
Notifications
You must be signed in to change notification settings - Fork 447
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
web: add ability to put extra stuff in <head> element of all pages #2872
Conversation
project.inc can include a constant HEAD_EXTRA. Its contents are inserted at the beginning of <head> tags. This makes it possible to use Google Analytics, which requires that a script be added at that point.
The function page_head includes this parameter
and in the code down lower there is your new code followed by the existing code
based on the description of the function parameter, it exists to serve the same purpose as your new code. It seems like there is overlap between your code and this existing mechanism. Does the existing mechanism not meet your need? Do we know if anyone uses the existing mechanism? Is there some way that the two mechanisms can be combined so that there isn't any overlap? |
Google analytics says their script must go at the start of the |
The Google documentation (https://developers.google.com/analytics/devguides/collection/analyticsjs/) specifies "near the top of the tag". I've experienced zero difference in the performance of the tracking code based on tag locations - it just works. I usually put it as the last tag in the I believe there is no need for an additional custom head section, especially considering that the new and old sections are only separated by a single meta tag, which does not load any assets and thus does not slow down the page load. |
The main thing is, this puts it in every page, |
Ah - so the parameter on the function is for use on a "per page" basis while the variable you have defined is more of a "global" setting. Is it worth calling it GLOBAL_HEAD_EXTRA to clarify the difference? Let me know what you think and then I'll merge. |
(process note - since Rytiss voiced an concern - he needs to indicate he is ok with the solution as well before I merge) |
I'm ok with this. |
Either name is fine. Probably not EXTRA_HEAD though. |
I think GLOBAL_HEAD_EXTRA make a good distinction between the other mechanism and this and will make it easier for someone in the future reading the code and deciding how to use the feature. If you could make that change then I will merge it. Thanks! |
@davidpanderson - can you review my last request for a change? I think it can be merged after that. Thanks. |
done |
Thanks for the update and contribution! |
project.inc can include a constant HEAD_EXTRA.
Its contents are inserted at the beginning of tags.
This makes it possible to use Google Analytics,
which requires that a script be added at that point.
Fixes #
Description of the Change
Alternate Designs
Release Notes