티스토리 수익 글 보기
{{ message }}
Clarify docs around a tag visitor’s boolean return value #1479
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Important
This is a follow-up PR to #1478. Merge that PR into
trunkbefore merging this PR, since it is branched off of that PR’s branch.Fixes #1342
The terminology around a tag visitor “visiting” a tag is fuzzy. It’s not clear what it means for a tag to be “visited”. In reality, what this means is that the tag is tracked/recorded in URL metrics so that it appears among its
elements, including theintersectionRectandclientBoundingRectamong other aspects captured bydetect.js. If a tag visitor does not need any of that information, then it can just always returnfalse, even though it may have “visited” a tag by applying some optimization to it. For example. Enhanced Responsive Images (auto-sizes) has a tag visitor doesn’t need that information to apply its optimizations as it just addsautoto thesizesattribute if it is lazy-loaded and doesn’t haveautoalready. This is a case where the tag visitor always returnsfalse.As explained in #1342, instead of returning a boolean value for whether to track the tag in URL metrics, it could be more sophisticated by detecting whether the tag visitor tried to access information about that tag from the stored URL metrics. Or instead of returning a boolean there could be a method on the context object like
$context->track_in_url_metrics()which would do the same. I could go either way. But these changes in the PR are a good iterative improvement at least and we can add such a method later.