Yes I did. But I was not able to understand that. So came here with a new post for a quick and precise answer. Thanks!
You can add stuff to the head in a theme component, as those guides describe. But having the code get fired where and when you want is another issue.
You might say more about what it is you are trying to do rather than describing your proposed solution.